vikasjayaram / ext-idp-api-webtask

Call External IDP API using the user idp access token with read:user_idp_token flow.
3 stars 5 forks source link

Cannot find module 'body-parser' error #1

Open dopoto opened 5 years ago

dopoto commented 5 years ago

After following the instructions in https://github.com/vikasjayaram/ext-idp-api-webtask/blob/master/RS256/README.md, I get the following error when I open the created web task URL in a browser:

{ "code": 400, "message": "Compilation failed: Cannot find module 'body-parser'", "error": "Cannot find module 'body-parser'", "stack": "Error: Cannot find module 'body-parser'\n at Function.Module._resolveFilename (module.js:548:15)\n at Function.WebtaskModule._resolveFilename (/data/sandbox/lib/module.js:25:27)\n at WebtaskModule.require (/data/sandbox/lib/module.js:102:39)\n at require (/data/sandbox/lib/module.js:137:21)\n at Object.<anonymous> (/data/io/9bb6fba5-6d3c-4779-9ebc-32280416b3dd/webtask.js:5:20)\n at WebtaskModule.compileWebtask (/data/sandbox/lib/module.js:96:34)\n at defaultJavascriptCompiler (/data/sandbox/lib/compiler.js:119:30)\n at defaultCompiler (/data/sandbox/lib/compiler.js:128:16)\n at /data/sandbox/lib/compiler.js:231:17\n at /data/sandbox/node_modules/async/dist/async.js:3880:24" }

What should I do to fix this problem?

dopoto commented 5 years ago

Made it work by adding a package.json file with the contents below in the same folder as the .js file:

{ "dependencies": { "moment": "2.24.0", "body-parser": "1.18.3", "express":"4.16.4", "webtask-tools": "3.4.0", "async":"2.6.2", "express-jwt": "5.1.0", "jwks-rsa": "1.1.1" } }