gcf-gmail-codelab icon indicating copy to clipboard operation
gcf-gmail-codelab copied to clipboard

unable to run watchmessages in nodejs14

Open pavitra15 opened this issue 4 years ago • 6 comments

pavitra15 avatar Aug 18 '21 06:08 pavitra15

same here, the problem seems to be from @google-cloud/express-oauth2-handlers, as mentioned #here

barth-loumi avatar Aug 19 '21 18:08 barth-loumi

Any solutions??

pavitra15 avatar Nov 22 '21 06:11 pavitra15

WhatsApp Image 2021-11-17 at 3 32 44 PM

how to solve this?

pavitra15 avatar Nov 24 '21 06:11 pavitra15

I resolved it but this is not an ideal solution, in light of https://github.com/GoogleCloudPlatform/express-oauth2-handlers/issues/11, I had to

a) add to pubsub/index.js line 1... process.env.GCP_PROJECT = 'enter your gcp project here' // GCP_PROJECT cannot be added to env_vars.yaml as redeployment will push this to a supported version of node b) deploy with deprecated runtime node v8 gcloud functions deploy watchGmailMessages --runtime=nodejs8 --trigger-topic=gmail-watch --env-vars-file=env_vars.yaml

ajayp avatar Jan 04 '22 23:01 ajayp

Hey guys,

since node10 there were some changes there as indicated in the documentation

FUNCTION_TRIGGER_TYPE | Use the FUNCTION_SIGNATURE_TYPE environment variable instead

https://cloud.google.com/functions/docs/migrating/nodejs-runtimes

since the dependencies are not updated, just add FUNCTION_TRIGGER_TYPE as CLOUD_PUBSUB_TRIGGER (env variables)

FUNCTION_TRIGGER_TYPE: CLOUD_PUBSUB_TRIGGER

with these changes it works as expected and as it did with node8

amurciasu avatar Feb 14 '22 14:02 amurciasu

GCP Node10 runtime introduced some environment variable changes which require modificiatons of the source code.

weynhamz avatar Mar 30 '23 02:03 weynhamz