Skip to content

Deployment failure: Function failed on loading user code. Error message: Node.js module defined by file index.js is expected to export function named helloPubSub #1340

@Kai68er

Description

@Kai68er

Hey,
i am trying to create a cloud function in GCP with the Console:
05-06-_2019_11-32-14

Unfortunately, I am getting an error after creating the cloud function:

Deployment failure:
Function failed on loading user code. Error message: Node.js module defined by file index.js is expected to export function named helloPubSub

I got the newest version here:
https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/functions/scheduleinstance/index.js

Nevertheless, if I get the files with git then I could successfully create cloud functions with the commands:
gcloud pubsub topics create start-instance-event
gcloud pubsub topics create stop-instance-event

In the instructions https://cloud.google.com/scheduler/docs/start-and-stop-compute-engine-instances-on-a-schedule it is explained that you have to use 2 instead of 1 script. If so, what is the correct naming for the cloud function?
05-06-_2019_11-34-06

It seems that before the start- and stop-function were splitted and now are parsed into one?
So it means that I still have to create 2 cloud functions?
It might make sense to update the "Scheduling Compute Instances with Cloud Scheduler"-article or at least expail it better in the README.

Thanks a lot.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions