What endpoint are you using?
/1.1/statuses/user_timeline.json

What API version are you on?
API version 1.1

Are you using a library or SDK? Which one?
I am using the npm twitter-api-v2 package.

What is the issue?
I am not sure if this is the appropriate place to place this topic, but I hope someone can help me out or point me in the right direction. I decided to host my code on my AWS Linux machine and created a separate app for it on the developer portal (I have elevated access).

I created a bash script (fetbot.sh) with the following code:

#!/bin/bash
while true
do
    node /home/ubuntu/DiscordBot/index.js
    sleep 1
done

When I run this in the terminal with the command: ./fetbot.sh
It runs perfectly:

Then, I created a service file (fetbot.service) which I placed in the /etc/systemd/system/ with the following:

[Service]
ExecStart=/home/ubuntu/DiscordBot/fetbot.sh

Once I run the system file with the following command: sudo systemctl start fetbot and I check the status, this is what the output is:

I hope that this was enough context. If anymore is needed, please do let me know and I appreciate your help and feedback.

This could be partly your problem. But if the v2 npm package specifically says it supports v1.1 API it may be ok.

It looks like the error relates to not having valid authentication - so the Consumer key (API key) and secret and access token and secret are missing or incorrect.

1 Like

Issue Fixed:

Apparently, I forgot to set the user and group in my service file which did not allow it to have access to the .env file which contained the credentials.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.