Auth0 Home Blog Docs

Testing hooks locally / in CI

testing
hooks

#1

I want to test my hooks in CI, but I can’t simply run my script using wt-cli serve because it needs to be compiled by the hooks compiler, which I don’t have access to.

For example, if I run the following hook.js using wt-cli serve hook.js --hostname localhost --port 1234

module.exports = function(client, scope, audience, context, cb) {
    cb(null, {
      result: "good"
    });
};

I get an error response:

{
	"code": 500,
	"error": "Script generated an unhandled synchronous exception.",
	"details": "TypeError: cb is not a function",
	"name": "TypeError",
	"message": "cb is not a function"
}

I’m assuming because hooks.js actually needs to be compiled by auth0’s hooks compiler. Are there any instructions regarding running compilers locally to compile hooks and then serve them?


#2