functions-samples
functions-samples copied to clipboard
convert-audio function error
i deploying functions i functions: ensuring necessary APIs are enabled... ✔ functions: all necessary APIs are enabled i functions: preparing functions directory for uploading...
Error: Error occurred while parsing your function triggers.
TypeError: require(...) is not a function
at Object.
I am following the instructions provided and I am getting the error shown above.
Can you provide an idea on what could fix this issue?
Regards
I had exactly the same problem. You need to change your require code for @google-cloud/storage
to something like the following:
const { Storage } = require('@google-cloud/storage');
const gcs = new Storage();
Sorry to clutter this page:
I followed your suggestion and got this...
functions[generateMonoAudio(us-central1)]: Deployment error. Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "
npm_installhad stderr output:\n/workspace/node_modules/ffmpeg-static/install.js:29\n url = new URL(url)\n ^\n\nReferenceError: URL is not defined\n at normalizeS3Url (/workspace/node_modules/ffmpeg-static/install.js:29:3)\n at Object.<anonymous> (/workspace/node_modules/ffmpeg-static/install.js:38:3)\n at Module._compile (module.js:653:30)\n at Object.Module._extensions..js (module.js:664:10)\n at Module.load (module.js:566:32)\n at tryModuleLoad (module.js:506:12)\n at Function.Module._load (module.js:498:3)\n at Function.Module.runMain (module.js:694:10)\n at startup (bootstrap_node.js:204:16)\n at bootstrap_node.js:625:3\nnpm ERR! code ELIFECYCLE\nnpm ERR! errno 1\nnpm ERR! [email protected] install:
node install.js\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the [email protected] install script.\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR! /builder/home/.npm/_logs/2020-04-14T07_36_42_305Z-debug.log\n\nerror:
npm_install` returned code: 1", "errorType": "InternalError", "errorId": "A0CF0542"}}
`
URL is not defined
either suggests you've not required URL
or that you're using an older version of Node. Check the package.json
for your functions and change the engines
setting like so:
"engines": {
"node": "10"
},
Both solutions worked perfectly.
I'll change the parameter to node 10 and I will let you know... THANKS for your AWESOME help