twitter-together / action

:bird: A GitHub action to tweet from a repository

Home Page:https://github.com/marketplace/actions/twitter-together

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tweeting poll throws with missing TWITTER_ACCOUNT_ID when actually provided

Nargonath opened this issue · comments

What happened?

I'm trying to test the tweet poll feature. The pipeline is in success but the tweet is not published. When checking the logs, there is an error "Error: TWITTER_ACCOUNT_ID environment variable must be set" even though it is set.
image

There is also another error which might come from the "missing" TWITTER_ACCOUNT_ID":

(node:2656) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'message' of undefined
    at /home/runner/work/_actions/gr2m/twitter-together/v1.x/dist/index.js:25821:56
    at Array.map (<anonymous>)
    at handlePush (/home/runner/work/_actions/gr2m/twitter-together/v1.x/dist/index.js:25821:37)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

What did you expect to happen?

I expected the tweet to be posted.

What the problem might be

If the problem lies on my side, perhaps I've used the wrong TWITTER_ACCOUNT_ID. Once my Twitter Ads account was validated I went to https://ads.twitter.com/ and got my account id from the URL https://ads.twitter.com/campaign/[ACCOUNT_ID].

I won't have time to debug the problem any time soon. Let's see if others run into the same problem, too. If not, it's likely a problem isolated to your setup. I'd appreciate any help to debug the problem.

You should be able to fork the repository and point your workflow file to your repository. Make sure to run npm run build which updates the /dist folder if you make any code changes, otherwise your code changes won't have any effect.

Thanks @gr2m for letting me know. I'll keep you posted if I find anything and we'll see if someone else has the problem too.

The problem was definitely on my side. I thought the TWITTER_ACCOUNT_ID was passed in the GitHub Workflow already but it was not the case. That's why I had the error even though my secret was set. My bad, sorry for the noise.

I'm glad I didn't waste your time on this. 😅

If a missing TWITTER_ACCOUNT_ID environment variable was the problem, then the error message should have stated that. I think there is an opportunity here to throw a more helpful error so other people who run into the same problem know exactly what to do. Would you like to start a PR on that?

I believe the message is already explicit. The first error message stated: Error: TWITTER_ACCOUNT_ID environment variable must be set. This due to the fact that the environment variable was set in the CI/CD but not passed as arguments to the GitHub action. Perhaps we could just add a mention to look at the GH action arguments.

The second error which states TypeError: Cannot read property 'message' of undefined was caused by the missing variable since once I passed it, the message went away. Perhaps what could be done is not throw the second message in the first place. I'll have a look at it to see what can be done.

I'll have a look at it to see what can be done.

Thanks Jonas, appreciate it!