I am trying to implement a Google Cloud function that is based on code in a Git style repository. I have the code linked to Google Cloud Platform\'s \"Source Repositories\"
I had a similar (possibly same?) problem. What happened with me is that all my files were in the format:
and the error kept saying it could not find main. I was guessing that this was because it had a parent folder. After looking at zipping into the parent for a bit I determined it wasn't the issue.
I downloaded the zip of and looked at autogenerated dialogflow cloud function code and noticed they had a "package.json" file. I instead just had a "requirements.txt" file. I copied the package.json file to my source code, editted it for the correct contents, zipped it, and the cloud function compiled correctly.
package.json looks like:
{
"name": "test",
"description": "testingThings",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"author": "ABCDEFG",
"engines": {
"node": "8"
},
"scripts": {
"start": "firebase serve --only functions:test",
"deploy": "firebase deploy --only functions:test"
},
"dependencies": {
"google-cloud-storage": "",
"google-cloud-firestore": "",
}
}
I believe they use this for deploying the google cloud functions so without it they break.