When Getting Started example for WebTask fails

I have been playing with WebTask from Auth0 a bit. Interested in, I followed the first example to run a basic “Hello, World!” script. When execute, webtasks responded with compilation failed error like:

  "code": 400,
  "message": "Compilation failed: Unexpected token ILLEGAL",
  "error": "Unexpected token ILLEGAL",
  "stack": "SyntaxError: Unexpected token ILLEGAL\n    at Object.exports.runInThisContext (vm.js:53:16)\n    at WebtaskModule.compileWebtask (/data/sandbox/lib/module.js:95:32)\n    at defaultJavascriptCompiler (/data/sandbox/lib/compiler.js:134:30)\n    at defaultCompiler (/data/sandbox/lib/compiler.js:143:16)\n    at /data/sandbox/lib/compiler.js:240:17\n    at /data/sandbox/node_modules/async/dist/async.js:3816:26\n    at replenish (/data/sandbox/node_modules/async/dist/async.js:982:17)\n    at iterateeCallback (/data/sandbox/node_modules/async/dist/async.js:967:17)\n    at /data/sandbox/node_modules/async/dist/async.js:944:16\n    at /data/sandbox/node_modules/async/dist/async.js:3821:13"

I searched a bit what could be the root cause and did not find anything. If you face the very same problem, check your .js file encoding. Mine was encoded to Unicode with BOM character and internal node.js does not like. When I saved it with UTF-8, the webtask started to greet everyone.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.