Giter Site home page Giter Site logo

wt-cli's Introduction

Webtask CLI: all you need is code

Command line tool for using webtasks to create microservices in seconds.

Setup

$ npm i -g wt-cli
$ wt init

Usage

Create a webtask

Write webtask code to the hello-world.js file:

module.exports = function (cb) {
  cb(null, 'Hello webtasks!');
}
wt create hello-world.js

and call it...

curl https://webtask.it.auth0.com/api/run/{yours}/hello-world

Create a webtask (from a public URL)

wt create https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/html-response.js \
          --name html-response-url

Create a webtask with a secret

wt create https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/mongodb.js \
          --name mongo \
          --secret MONGO_URL=mongodb://webtask:[email protected]:47592/webtask-examples

This is a real mongodb URL (powered by mongolab), no guarantee that it will work :)

Create a webtask that integrates with express.js

wt create https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/express.js \
          --name express \
          --dependency express \
          --dependency body-parser

Log streaming

wt logs

Cron a webtask (long running)

wt cron schedule -n mongocron \
                 -s MONGO_URL=mongodb://webtask:[email protected]:47592/webtask-examples \
                 "*/10 * * * *" \
                 https://raw.githubusercontent.com/auth0/wt-cli/master/sample-webtasks/mongodb.js

This cron will insert a document in a mongo collection every 10 minutes

Get cron history

wt cron history mongogron

Get all scheduled webtasks

wt cron ls

Auth0 CLI: extend Auth0 with custom code (BETA)

Auth0 hooks enable you to extend the Auth0 platform with custom code. Auth0 CLI allows you to manage Auth0 hooks for your Auth0 account.

Auth0 hooks are webtasks associated with specific extensibility points of the Auth0 platform that are invoked by Auth0 runtime to execute your custom logic.

Setup

Follow the instructions from the Account > Webtasks panel on the Auth0 management dashboard to install and configure wt-cli. The package now includes auth0 binary in addition to wt.

NOTE While Auth0 CLI is in BETA, the wt-cli tool must be installed from a branch of this repository instead of the public npm registry. Use npm i -g auth0/wt-cli#auth0 to install the tool. The rest of the instructions on the Auth0 management portal applies without changes.

Overview

Auth0 CLI allows you to create, list, enable/disable, edit, and remove Auth0 hooks associated with specific extensibility points within the Auth0 platform, as well as receive real-time logging information generated by custom code.

The list of supported extensibility points will be growing over time. Currently, the following extensibility points are supported:

client-credentials-exchange password-exchange pre-user-registration post-user-registration

For each of the extensibility points, there can be several Auth0 hooks created. A hook can be enabled or disabled, but only up to one hook per extensibility point can be enabled at a time. Disabled hooks are useful for staging new functionality.

Synopsis

The script below assumes you are creating an Auth0 hook for the pre-user-registration extensibility point using profile name tj-default. You can use any of the extensibility points listed above and the actual profile name has been provided to you during wt-cli setup.

# Scaffold sample code of an Auth0 hook:
auth0 scaffold -t pre-user-registration > file.js

# Create a new, disabled Auth0 hook:
auth0 create -t pre-user-registration --name my-extension-1 -p tj-default file.js

# Edit code of the Auth0 hook:
auth0 edit my-extension-1

# Enable the newly created extensibility point (all other hooks associated
# with the same extensibility point will be disabled):
auth0 enable my-extension-1 -p tj-default

# List hooks for a specific extensibility point:
auth0 ls -t pre-user-registration -p tj-default

# List all Auth0 hooks on your account:
auth0 ls -p tj-default

# Access streaming, real-time logs of all of your hooks:
auth0 logs -p tj-default

# Disable a hook:
auth0 disable my-extension-1 -p tj-default

# Delete a hook:
auth0 rm my-extension-1 -p tj-default

Closing remarks

Working behind a proxy

wt-cli supports operating behind a proxy as of v6.1.0. The cli relies on the HTTP_PROXY (or http_proxy) environment variable to determine if proxy support needs to be enabled. The HTTP_PROXY environment variable must be set to a uri according to the following table:

Protocol Proxy Agent for http requests Proxy Agent for https requests Example
http http-proxy-agent https-proxy-agent http://proxy-server-over-tcp.com:3128
https http-proxy-agent https-proxy-agent https://proxy-server-over-tls.com:3129
socks(v5) socks-proxy-agent socks-proxy-agent socks://username:[email protected]:9050 (username & password are optional)
socks5 socks-proxy-agent socks-proxy-agent socks5://username:[email protected]:9050 (username & password are optional)
socks4 socks-proxy-agent socks-proxy-agent socks4://some-socks-proxy.com:9050
pac pac-proxy-agent pac-proxy-agent pac+http://www.example.com/proxy.pac

Issue Reporting

If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.

Author

Auth0

License

This project is licensed under the MIT license. See the LICENSE file for more info.

wt-cli's People

Contributors

bananaoomarang avatar callemo avatar christiannwamba avatar cristiandouce avatar cyhsutw avatar cyx avatar demophoon avatar dependabot[bot] avatar fyockm avatar ggoodman avatar glennblock avatar greg-johns avatar huan avatar jcenturion avatar joshbetz avatar jsierles avatar luisrudge avatar lzychowski avatar notmyself avatar outcoldman avatar patheticpat avatar pkaminski avatar rdaniels6813 avatar rwtombaugh avatar ryan-knowles avatar skyhacks avatar tjanczuk avatar tjrivera avatar twelvenights avatar woloski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wt-cli's Issues

Default CRON interval should be less frequent

The wt cron -h shows wt cron schedule [options] "* * * * *" [file_or_url] as hint for creating a CRON. Should we use a less frequent default (e.g. every 15 mins) since otherwise we will end up with a million of 1-minute hello, world CRON jobs?

wt create shouldn't cache

By default everything is cached (name->token) and (token->code). We should make the opposite and don't cache anything unless you specify (--cache) or maybe differentiate with the url /prod /dev

A way to see the tasks created (and how to delete them)?

Hi,

Just started playing around with webtasks and only trying to get my head around the architecture now, and thus might well be missing something here. But, after creating a couple of tasks, I started wondering where could I see all tasks I've created? And how about deleting them? I see a fairly full-featured CLI API for managing scheduled tasks, but how about the regular ones?

I assume all these tasks are gone if I delete the profile or revoke my token (?).

Error Socket Hangup

I tried making a webtask which simply emits things to pusher, [extraneous: notoriously pusher has webpack as an optional dependency]. When I run the command

wt create --no-parse --secret Some=Secret --bundle index.js

I get the following error, I assume that it might be caused by the resulting package being too large.

Error: socket hang up
    at createHangUpError (_http_client.js:210:15)
    at TLSSocket.socketOnEnd (_http_client.js:295:23)
    at emitNone (events.js:73:20)
    at TLSSocket.emit (events.js:167:7)
    at endReadableNT (_stream_readable.js:906:12)
    at nextTickCallbackWith2Args (node.js:455:9)
    at process._tickCallback (node.js:369:17)

wt init <email_or_phone>

this is a shortcut that will be used on webtask.io/cli that will skip the step of asking email/phone

Don't show token in terminal for `wt edit`

For wt edit, I wonder if we should be showing the entire URL in the console. Folks can grab it from the browser address line if they want to, and the fewer places the token is shown the better.

wt create default message is confusing

We've got feedback from @cristiandouce and @mgonto that they are not sure what to do with the webtask url on wt create.

So I suggest adding something like this:

$ wt create foo.js
webtask succesfuly created (in green)

        $ curl https://...../foo

unless we are in --watch mode

wt scaffold

wt scaffold auth0/webtasks/simple-express.js
  • pull a scaffold from the github repo
  • runs wt create against that (using -n)
  • store the file on the current directory
  • prints the path of the file name and the url
wt scaffold woloski/dwh-webtask
  • pull a scaffold from the github repo (assume a file called webtask.js?)
  • ssame as above
wt scaffold
  • reads from a registry all the scaffold we know

`wt logs` stop working

Sometimes, I got this error [04:02:04.231Z] ERROR wt: Unexpected end of input. When that happends, wt logs stops working.

payload too large - nothing but 40 lines of es6 w/ async, xml2js, and axios

I'm reporting this as it was requested at the bottom of the log there. :)

source:

'use latest'
'use strict'

require("babel-polyfill");

import {get} from 'axios'
import {parseString} from 'xml2js'

const deviantArtAPI = 'http://backend.deviantart.com/rss.xml'

function getRandomIntInclusive(min, max) {
  min = Math.ceil(min);
  max = Math.floor(max);
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

function xml2jsPromise(data) {
  return new Promise((resolve, reject) => {
    parseString(data, 
      (err, result) => err? reject(err) : resolve(result))
  })
}

/* here be magic */
export default async (context, callback) => {
  // surprisingly, there's no raw queryString on context.
  const paramstring = Object.entries(context.data)
    .reduce((p,c) => { 
      const key = encodeURIComponent(c[0])
      const val = encodeURIComponent(c[1])
      p.push(key + '=' + val)
      return p 
    }, []).join('&') || 'order=67108864&offset=0&q=overwatch'

console.log('requesting: ' + deviantArtAPI + '?' + paramstring)

    // getting the RSS feed of images requested, either from a search configured 
    // from the provided query string, or from the default
    let rawRSS
    try {
      rawRSS = await get(deviantArtAPI + '?' + paramstring)
        .catch(e => {throw e})
      console.log('...done')
    } catch (e) {
      console.error(e)
    }

    let oRes //object of Result
    try {
      oRes = await xml2jsPromise(rawRSS.data)
    } catch(e) {
      console.error(e)
    }

    let images = []
    oRes.rss.channel[0].item
      .forEach(i => {
        images.push(i['media:content'][0]['$'].url)
      })
    
    const imageURL = images[getRandomIntInclusive(0, images.length - 1)]

console.log('requesting image: ' + imageURL)

     return await get(imageURL)
}

with babelrc

{ 
  "presets": ["es2015"],
  "plugins": ["add-module-exports","syntax-async-functions","transform-regenerator"]
  }

producing:

PS C:\Users\roberto\github\auth0-webtask> wt create --bundle ./deviantart.js
onWebtaskError Error: Payload Too Large
    at Request.callback (C:\Users\roberto\AppData\Roaming\npm\node_modules\wt-cli\node_modules\superagent\lib\node\index
.js:698:17)
    at IncomingMessage.<anonymous> (C:\Users\roberto\AppData\Roaming\npm\node_modules\wt-cli\node_modules\superagent\lib
\node\index.js:922:12)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
Uncaught error:  Request body size exceeds 122880
Error: Payload Too Large
    at Request.callback (C:\Users\roberto\AppData\Roaming\npm\node_modules\wt-cli\node_modules\superagent\lib\node\index
.js:698:17)
    at IncomingMessage.<anonymous> (C:\Users\roberto\AppData\Roaming\npm\node_modules\wt-cli\node_modules\superagent\lib
\node\index.js:922:12)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
Please report this at: https://github.com/auth0/wt-cli/issues

wt update broken

wt update was working fine earlier today but now I'm getting this error after installing v5.0.0

$ wt update variable-stripe-button variable-pay-button.js
Uncaught error:  Cannot read property 'length' of undefined
<details>
TypeError: Cannot read property 'length' of undefined
    at createWebtask (/Users/ivan/.nvm/versions/node/v7.7.4/lib/node_modules/wt-cli/lib/createWebtask.js:21:26)
    at onClaims (/Users/ivan/.nvm/versions/node/v7.7.4/lib/node_modules/wt-cli/bin/update.js:89:16)
From previous event:
    at Namespace.handleUpdate [as $handler] (/Users/ivan/.nvm/versions/node/v7.7.4/lib/node_modules/wt-cli/bin/update.js:77:10)
    at Array.eval (eval at makeMethodCaller (/Users/ivan/.nvm/versions/node/v7.7.4/lib/node_modules/wt-cli/node_modules/structured-cli/node_modules/bluebird/js/release/call_get.js:18:12), <anonymous>:9:36)
    at Array.tryCatcher (/Users/ivan/.nvm/versions/node/v7.7.4/lib/node_modules/wt-cli/node_modules/structured-cli/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/ivan/.nvm/versions/node/v7.7.4/lib/node_modules/wt-cli/node_modules/structured-cli/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/ivan/.nvm/versions/node/v7.7.4/lib/node_modules/wt-cli/node_modules/structured-cli/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromiseCtx (/Users/ivan/.nvm/versions/node/v7.7.4/lib/node_modules/wt-cli/node_modules/structured-cli/node_modules/bluebird/js/release/promise.js:606:10)
    at Async._drainQueue (/Users/ivan/.nvm/versions/node/v7.7.4/lib/node_modules/wt-cli/node_modules/structured-cli/node_modules/bluebird/js/release/async.js:138:12)
    at Async._drainQueues (/Users/ivan/.nvm/versions/node/v7.7.4/lib/node_modules/wt-cli/node_modules/structured-cli/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/Users/ivan/.nvm/versions/node/v7.7.4/lib/node_modules/wt-cli/node_modules/structured-cli/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:666:20)
    at tryOnImmediate (timers.js:639:5)
    at processImmediate [as _immediateCallback] (timers.js:611:5)
Please report this at: https://github.com/auth0/wt-cli/issues
</details>

Cannot read property 'formatUsage' of undefined

One issue and a question.

Issue:

tj-mac:wt-cli tomek$ ./bin/wt token create -p int --url https://wt-is-1.it.auth0.com 
{ [Error: --token must be specified with --url] code: 'E_INVALID', data: undefined, isCli: true } 'undefined' 'undefined'
Uncaught error:  Cannot read property 'formatUsage' of undefined

After I comment out the line using formatUsage, I get the following:

tj-mac:wt-cli tomek$ ./bin/wt token create -p int --url https://wt-is-1.it.auth0.com 
--token must be specified with --url

Question: what is rationale for this limitation? I want to take my token (opaque key in this case) from my profile, but override the url using --url.

Uncaught error: Request body size exceeds 122880

When creating a webtask for a .js file that is 2.6MB I receive the following:
Uncaught error: Request body size exceeds 122880 Error: Payload Too Large at Request.callback (/usr/local/lib/node_modules/wt-cli/node_modules/superagent/lib/node/index.js:698:17) at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/wt-cli/node_modules/superagent/lib/node/index.js:922:12) at emitNone (events.js:72:20) at IncomingMessage.emit (events.js:166:7) at endReadableNT (_stream_readable.js:913:12) at nextTickCallbackWith2Args (node.js:442:9) at process._tickCallback (node.js:356:17) Please report this at: https://github.com/auth0/wt-cli/issues
The file was created using Webtask Bundle and was including the GCloud module if it helps to reproduce the problem.

Cannot find module './build/Debug/DTraceProviderBindings'

When running any wt-cli commands, I get the following error.

{ Error: Cannot find module './build/Debug/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/wt-cli/node_modules/dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/wt-cli/node_modules/bunyan/lib/bunyan.js:79:18)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/wt-cli/lib/logs.js:1:76)
    at Module._compile (module.js:541:32) code: 'MODULE_NOT_FOUND' }

tighter integration with auth0

authenticated webtask

wt create webtask.js --auth

This webtask will be secured so that only can be called with a valid JSON Web Token on the Authorization header signed with a pre-configued secret. By default we will have a shared Auth0 account for this that will have an application/client registered.

If the Authorization header is not provided, then return 401.

authenticated webtask based on email

wt create webtask.js --auth="@company.com,[email protected]"

This will not only check the token is valid but also that the email_verified flag on the token is true and it matches one of these: an email with @company.com domain or an email with [email protected]. A user can specify multiple emails and/or domains.

authenticated webtask with your own Auth0 account

wt create webtask --auth --clientid=... ---clientsecret=...

With this setting you can configure your own Auth0 clientid and secret.

Feature Request: Search directory tree for nearest .webtask config file

I want to share a project-specific .webtask file with other developers working on the project, without having to explain "First create a .webtask file in your home directory, then paste this in. Or if you already have one, you should manually merge the JSON." Not to mention if you needed to make changes to existing profiles...

I poked around in the code. It seems like potentially the ConfigFile stuff could take care of this? Can you recommend how and where you would make this addition, and maybe I can get it done?

Add back `url` and `token` to `wt create`

@geoff: I see wt create no longer accepts cluster URL or token. It used to allow all parameters normally in the profile to be explicitly specified - this makes scripting much easier (no need for a profile). Can we get it back?

Optionally show token on `wt create1

wt create hello.js shows the token and the URL by default. I think token is interesting and the ability to show this important, but in a small minority of cases. I wonder if this could be less prominent (output option)?

Uncaught error: Request body size exceeds 122880, Payload Too Large

I'm trying to create a task with a 1.5MB directory.

Here's the stacktrace:

Uncaught error:  Request body size exceeds 122880
Error: Payload Too Large
    at Request.callback (/usr/local/lib/node_modules/wt-cli/node_modules/superagent/lib/node/index.js:698:17)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/wt-cli/node_modules/superagent/lib/node/index.js:922:12)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:913:12)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)
Please report this at: https://github.com/auth0/wt-cli/issues
child_process.js:507
    throw err;
    ^

Error: Command failed: wt create /Users/REDACTED/Code/REDACTED <REDACTED>
Uncaught error:  Request body size exceeds 122880
Error: Payload Too Large
    at Request.callback (/usr/local/lib/node_modules/wt-cli/node_modules/superagent/lib/node/index.js:698:17)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/wt-cli/node_modules/superagent/lib/node/index.js:922:12)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:913:12)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)
Please report this at: https://github.com/auth0/wt-cli/issues

  at checkExecSyncError (child_process.js:464:13)
  at Object.execSync (child_process.js:504:13)
  at Object.<anonymous> (/Users/<REDACTED>/Code/<REDACTED>.js:41:14)
  at Module._compile (module.js:409:26)
  at Object.Module._extensions..js (module.js:416:10)
  at Module.load (module.js:343:32)
  at Function.Module._load (module.js:300:12)
  at Function.Module.runMain (module.js:441:10)
  at startup (node.js:139:18)
  at node.js:968:3

Problem updating task

I just started playing with Webtasks, but when I try to update the sample script, I get an error:

$ wt update hello hello.js
Uncaught error:  Invalid query: ValidationError: child "decrypt" fails because ["decrypt" must be a number]
Error: Bad Request
    at Request.callback (/usr/local/lib/node_modules/wt-cli/node_modules/superagent/lib/node/index.js:698:17)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/wt-cli/node_modules/superagent/lib/node/index.js:922:12)
    at emitNone (events.js:85:20)
    at IncomingMessage.emit (events.js:179:7)
    at endReadableNT (_stream_readable.js:906:12)
    at nextTickCallbackWith2Args (node.js:474:9)
    at process._tickCallback (node.js:388:17)
Please report this at: https://github.com/auth0/wt-cli/issues

Impossible to init through proxy

Hi,

I've seen with the team on slack, it seems that the wt init (i'm on windows) is not reading any proxy values, preventing me to do correctly the init process with my id.

Working on windows, node 4.2.6, wt-cli 1.1.4

Messy output for examples in help [Windows]

Hi,

Not sure whether this should be reported against nested-yargs instead, and not sure if this is a bug or a feature in the first place. But here it goes anyway, feel free to close this in case you don't see anything to change here.

The wt (or wt --help or equivalent) command prints out the help with examples, but is showing the full path to the executable. At least on Windows, this leads to quite messy output, making it harder to spot the essential part of each example. I'd personally be just fine with wt create --name foo file.js etc.

wt-examples-output

Error: Module version mismatch

Error: Module version mismatch. Expected 48, got 47.
at Error (native)
at Object.Module._extensions..node (module.js:568:18)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/wt-cli/node_modules/dtrace-provider/dtrace-provider.js:17:23)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/wt-cli/node_modules/bunyan/lib/bunyan.js:79:18)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
{ Error: Cannot find module './build/default/DTraceProviderBindings'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/wt-cli/node_modules/dtrace-provider/dtrace-provider.js:17:23)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/wt-cli/node_modules/bunyan/lib/bunyan.js:79:18)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/wt-cli/lib/logs.js:1:76)
at Module._compile (module.js:541:32) code: 'MODULE_NOT_FOUND' }
{ Error: Cannot find module './build/Debug/DTraceProviderBindings'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/wt-cli/node_modules/dtrace-provider/dtrace-provider.js:17:23)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/wt-cli/node_modules/bunyan/lib/bunyan.js:79:18)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/wt-cli/lib/logs.js:1:76)
at Module._compile (module.js:541:32) code: 'MODULE_NOT_FOUND' }
Uncaught error: Request body size exceeds 122880
Error: Payload Too Large
at Request.callback (/usr/local/lib/node_modules/wt-cli/node_modules/superagent/lib/node/index.js:698:17)
at IncomingMessage. (/usr/local/lib/node_modules/wt-cli/node_modules/superagent/lib/node/index.js:922:12)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:973:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
Please report this at: https://github.com/auth0/wt-cli/issues

CORS support for `wt serve`?

Hey folks - just wanted to see if there was any interest in having CORS support for the wt serve command.

If possible, I'd like to have my localhost:1234ed web app hitting my localhost:8080ed webtask server, but that obviously throws a CORS error.

Looks like support for that might have to be added in webtask-runtime, so I wanted to see if that would possibly be on the roadmap. In the meantime, I can just keep uploading to a webtask dev version.

CLI unusable : ReferenceError: Sandbox is not defined

After an update of wt-cli, I'm not able to use it anymore.

I've got this error :

Sandbox.prototype.updateStorage = function (storage, options, cb) {
^

ReferenceError: Sandbox is not defined
    at Object.<anonymous> (/usr/local/lib/node_modules/wt-cli/node_modules/sandboxjs/lib/webtask.js:275:1)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/wt-cli/node_modules/sandboxjs/lib/sandbox.js:8:15)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/wt-cli/node_modules/sandboxjs/lib/index.js:3:15)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)

How to use wt serve

May be I missed something, but I cannot find a way to use "wt serve" command :

sample webtask "bar.js" :

const webtaskTools = require('webtask-tools')
const express = require('express')
const app = express()

app.get('/', (req, res) => {
    res.json({foo: 'bar'})
})

module.exports = webtaskTools.fromExpress(app)

then I run :

$ npm i
$ wt serve ./bar.js
Your webtask is now listening for IPv4 traffic on 0.0.0.0:8080

then :

$ curl http://localhost:8080/bar

failed with :

{
  "code": 500,
  "error": "Script generated an unhandled synchronous exception.",
  "details": "TypeError: Cannot read property 'replace' of undefined",
  "name": "TypeError",
  "message": "Cannot read property 'replace' of undefined"
}

node version : v7.2.1

`auth0 create` fails with "Cannot read property 'length' of undefined" error

I'm trying to create a pre-registration hook via CLI and getting the following error:

$  auth0 create -t pre-user-registration --name my-extension-1 -p tham-default file.js
Uncaught error:  Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
    at createWebtask (/usr/local/lib/node_modules/wt-cli/lib/createWebtask.js:21:26)
    at _create (/usr/local/lib/node_modules/wt-cli/bin/auth0_create.js:131:16)
    at /usr/local/lib/node_modules/wt-cli/bin/auth0_create.js:110:16
    at tryCatcher (/usr/local/lib/node_modules/wt-cli/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/wt-cli/node_modules/bluebird/js/main/promise.js:510:31)
    at Promise._settlePromiseAt (/usr/local/lib/node_modules/wt-cli/node_modules/bluebird/js/main/promise.js:584:18)
    at Promise._settlePromises (/usr/local/lib/node_modules/wt-cli/node_modules/bluebird/js/main/promise.js:700:14)
    at Async._drainQueue (/usr/local/lib/node_modules/wt-cli/node_modules/bluebird/js/main/async.js:123:16)
    at Async._drainQueues (/usr/local/lib/node_modules/wt-cli/node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues (/usr/local/lib/node_modules/wt-cli/node_modules/bluebird/js/main/async.js:15:14)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
Please report this at: https://github.com/auth0/wt-cli/issues

wt-cli version: 5.1.2
Also wt profile ls shows the tham-default profile.

What could have gone wrong?

Opening webtask editor with empty webtask produces a wrong wording

Using wt-cli to open a named webtask produce a clear output:

wt edit wt-name
Opening wt-name in your browser...

However opening the editor without a named webtask, work as expected but the wording isn't good from the user experience standpoint.

wt edit
Opening null in your browser...

Upgrade Node.js for security fixes #security-nodejs-20160209

Please upgrade Node.js to v0.12.10, v4.3.0, v5.6.0, or newer, to address the security issues listed here:
https://groups.google.com/forum/#!topic/nodejs-sec/G8IA0G4uA88.

Due date for this request is 2016-02-26.

This update addresses the following issues:

Please acknowledge that you've received this request and that it makes sense.
If it's not applicable to your repo, let me know so I can fix my list.

Thank you!

Change welcome message

The current message is too much for a user who just started. I suggest changing it to:

Welcome to webtasks! Create your first webtask as follows:

echo "module.exports = function (cb) {cb(null, 'Hello');}" > hello.js
wt create hello.js

wt logs by default should not be that verbose

For a webtask that has two console.log like this

console.log('foo');
console.log('request received', context.data);

This is all I see

[13:17:42.503Z]  INFO wt: connected to streaming logs (container=wt-matiasw-gmail_com-1)
[13:17:48.194Z]  INFO sandbox-proxy:  (tenant=wt-matiasw-gmail_com-1, attempt=1, req_id=1436447868140.41539, offset=132)

[13:17:48.286Z]  INFO sandbox-kafka:  (container=sandbox-36, tenant=wt-matiasw-gmail_com-1, sandbox=1, offset=133)

[13:17:48.481Z]  INFO sandbox-kafka:  (container=sandbox-36, tenant=wt-matiasw-gmail_com-1, sandbox=1, offset=134)

[13:17:48.482Z]  INFO sandbox-kafka:  (container=sandbox-36, tenant=wt-matiasw-gmail_com-1, sandbox=1, offset=135)

[13:17:48.489Z]  INFO sandbox-proxy:  (req_id=1436447868140.41539, status=200, tenant=wt-matiasw-gmail_com-1, container_id=36, latency=349, offset=136)

This is what I'd like to see

[13:17:48.286Z] INFO: foo
[13:17:48.312Z] INFO: request.received
  {
     ...
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.