You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, this does not work for me. The catch block is simply never executed and I get the same undefined and function stopped behavior.
Reproduction
I know for a fact that this is exactly what happens. Both because I debugged this a lot and also because I have my Google Cloud Function set up with a CRON job - it just failed for 17 hours straight (see creativecreatorormaybenot/github-tracker#54).
You can view my code here (open source implementation). I have the twitter.post call in three other places and whenever it is called before the end of the function, e.g. here, the function will crash immediately and not save any data (which is how I can confirm that this is the actual behavior). Once I remove the twitter.post calls, everything works again. However, using try { await twitter.post(..) } catch {} does not help and neither does .catch.
Environment
I am running in a Google Cloud Functions environment using Node 12 and Typescript.
The text was updated successfully, but these errors were encountered:
Use case
I use
Twitter.post
in order to post status updates, i.e. all my calls are as simple as:Problem
Whenever Twitter rejects my tweet because I am:
twitter.post
completely crashes my function. I get no errors. Instead, my logs look like this:The
undefined
is only printed whentwitter.post
crashes.Try-catch
The README says that I should be able to catch errors:
However, this does not work for me. The
catch
block is simply never executed and I get the sameundefined
and function stopped behavior.Reproduction
I know for a fact that this is exactly what happens. Both because I debugged this a lot and also because I have my Google Cloud Function set up with a CRON job - it just failed for 17 hours straight (see creativecreatorormaybenot/github-tracker#54).
You can view my code here (open source implementation). I have the
twitter.post
call in three other places and whenever it is called before the end of the function, e.g. here, the function will crash immediately and not save any data (which is how I can confirm that this is the actual behavior). Once I remove thetwitter.post
calls, everything works again. However, usingtry { await twitter.post(..) } catch {}
does not help and neither does.catch
.Environment
I am running in a Google Cloud Functions environment using Node 12 and Typescript.
The text was updated successfully, but these errors were encountered: