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

RESOURCE_ERROR when deploying a cloud function #272

Closed ankkho closed 3 years ago

ankkho commented 3 years ago

Hi,

I received the following error when deploying the function onto GCP using sls deploy command. I've used the latest version, downgrading does not solve the issue.

{ 
  “ResourceType”:“gcp-types/cloudfunctionsv1:projects.locations.functions”,
  “ResourceErrorCode”:“400”,
  “ResourceErrorMessage”:“Build failed: function.js does not exist; Error ID: 7485c5b6”
}

index.js

exports.testFunction = (event, context, callback) => {
  console.info({event, context})
  callback();
};

serverless.yml:

service: sample

provider:
name: google
stage: ${env:NODE_ENV}
runtime: nodejs14
region: asia-southeast2
project: sample
credentials: …/key.json

frameworkVersion: ‘2’

plugins:

serverless-webpack
serverless-google-cloudfunctions
custom:
webpack:
includeModules:
packagePath: ‘…/package.json’
packager: ‘yarn’

package:
patterns:
- ‘!.gitignore’

functions:
testFunction:
handler: testFunction
events:
- event:
eventType: providers/cloud.pubsub/eventTypes/topic.publish
resource: projects/testing/topics/test
     Operating System:          darwin
     Node Version:              14.4.0
     Framework Version:         2.55.0 (standalone)
     Plugin Version:            5.4.3
     SDK Version:               4.2.6
     Components Version:        3.15.1

Can someone provide any suggestions?

Thanks in advance!