Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Kai68er opened this issue Jun 5, 2019 · 2 comments
Assignees

Comments

@Kai68er
Copy link

Kai68er commented Jun 5, 2019

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.

@fhinkel
Copy link
Contributor

fhinkel commented Jun 5, 2019

@ace-n Could you have a look at this functions questions? Thanks!

@ace-n
Copy link
Contributor

ace-n commented Jun 5, 2019

@Kai68er - it looks like you forgot to set the Function to execute property when deploying your function in the Cloud Console. (helloPubSub is the default value for that.)

I'll close this for now - please re-open if you aren't able to resolve this issue.

@ace-n ace-n closed this as completed Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants