Would you like the webtask.io experience in your own SaaS? Try

Simple webtask not working


I have the following webtask with a dependency…

"devDependencies": {
  "babel-preset-env": "^1.7.0",
  "uport": "^0.6.2",
  "wt-cli": "file:../../../wt-cli"

const uPort = require('uport');

module.export = function(ctx, done){
  done(null, {
      response: "Test"

But when I try to run I get…

“code”: 400,
“message”: “Compilation failed: Cannot find module ‘uport’”,
“error”: “Cannot find module ‘uport’”,
“stack”: “Error: Cannot find module ‘uport’\n at Function.Module._resolveFilename (module.js:547:15)\n at Function.WebtaskModule._resolveFilename (/data/sandbox/lib/module.js:25:27)\n at WebtaskModule.require (/data/sandbox/lib/module.js:101:39)\n at require (/data/sandbox/lib/module.js:136:21)\n at Object. (/data/io/95ef4b8b-b4b7-4162-9aa4-f500f1681bba/webtask.js:1:77)\n at WebtaskModule.compileWebtask (/data/sandbox/lib/module.js:95: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 am I missing? I tried bundle but that is super hosed and doesn’t work. I also tried const uPort = require('uport@version');

Note: This topic was migrated from the Auth0 Community.


Thank for reaching out to us. This sounds frustrating! Happy to help you get it working. There are a couple issues going on here from what I can infer from your message.

  1. uPort is listed as a development dependency in your package.json. It needs to be a direct dependency based in the code sample you gave. Try running a npm install uport --save to get it in the right place.
  2. Next, for the wt cli to pay attention to your package.json it needs to be in the same directory as the webtask code. For example, if you are creating your webtask with the command wt create src/task.js the package.json needs to be in the src directory. The cli will then scan the packages listed there and automatically add them as dependencies to the webtask.
  3. You mention that bundling is not working for you. You didn’t specify what the issue with bundling was, but this is also a common issue when a package.json is not found next to the webtask code. The bundler attempts to bundle your dependencies into the webtask code which causes it to exceed the file size limit when pushing to the webtask environment. The intention of the --bundle flag is to bundle your code that might be split up into multiple files for organization reasons, not to bundle your dependencies.

Let me know if this helps you get unblocked.

  1. It is in the same folder
  2. https://github.com/auth0/webtask-bundle/issues/27

I will try 1


Thanks 1 did work I can now see the proper response


Excellent! Glad we figured it out. Thanks for using webtask.