serverless / serverless-google-cloudfunctions

Serverless Google Cloud Functions Plugin – Adds Google Cloud Functions support to the Serverless Framework
https://www.serverless.com
MIT License
271 stars 126 forks source link

update google provider version, deprecate old stuff #312

Open allen-munsch opened 8 months ago

allen-munsch commented 8 months ago

try to update github workflow, update, and deprecate unsupported versions

Example error showing the node 20 version:

03:48:13 jm@pop-os serverless-functions ±|main ✗|→ node_modules/.bin/serverless deploy --force
Compiling function "first"...
Uploading artifacts...
Artifacts successfully uploaded...
Updating deployment...
Checking deployment update progress...
...............Environment: linux, node 20.11.1, framework 3.38.0 (local), plugin 7.2.3, SDK 4.5.1
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: Deployment failed: RESOURCE_ERROR

     {"ResourceType":"gcp-types/cloudfunctions-v1:projects.locations.functions","ResourceErrorCode":"400","ResourceErrorMessage":"Function failed on loading user code. This is likely due to a bug in the user code. Error message: Provided module can't be loaded.\nIs there a syntax error in your code?\nDetailed stack trace: ReferenceError: exports is not defined in ES module scope\n    at file:///workspace/index.mjs:42:1\n    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)\n    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)\n    at async importModuleDynamicallyWrapper (node:internal/vm/module:431:15)\n    at async getUserFunction (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/loader.js:93:30)\n    at async main (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/main.js:35:32)\nCould not load the function, shutting down.. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation."}
    at throwErrorIfDeploymentFails (/home/jm/projects/ccs-projects/infrastructure/serverless-functions/node_modules/serverless-google-cloudfunctions/shared/monitorDeployment.js:71:11)
    at /home/jm/projects/ccs-projects/infrastructure/serverless-functions/node_modules/serverless-google-cloudfunctions/shared/monitorDeployment.js:42:17
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

1 deprecation found: run 'serverless doctor' for more details

And after updating and fixing the exports:

03:53:13 jm@pop-os serverless-functions ±|main ✗|→ node_modules/.bin/serverless deploy --force
Compiling function "first"...
Uploading artifacts...
Artifacts successfully uploaded...
Updating deployment...
Checking deployment update progress...
.........................
Done...
Service Information
service: planeso-to-discord-webhook
project: asdfasdf-123123
stage: dev
region: us-east4

Deployed functions
first
  https://blahblah.cloudfunctions.net/planeso-to-discord-webhook-dev-first

Removing old artifacts...

1 deprecation found: run 'serverless doctor' for more details

Need a faster logging experience than CloudWatch? Try our Dev Mode in Console: run "serverless dev"