# POST user registration hook returning "data/sandbox/node\_modules...." error

**URL:** <https://community.auth0.com/t/post-user-registration-hook-returning-data-sandbox-node-modules-error/18399>\
**Category:** Get Help\
**Created:** [November 27, 2018, 5:32pm UTC](https://community.auth0.com/t/post-user-registration-hook-returning-data-sandbox-node-modules-error/18399 "2018-11-27T17:32:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shilpa.c.kumar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/shilpa.c.kumar/32/9806_2.png) [@shilpa.c.kumar](https://community.auth0.com/u/shilpa.c.kumar)\
**Post date:** [November 27, 2018, 5:32pm UTC](https://community.auth0.com/t/post-user-registration-hook-returning-data-sandbox-node-modules-error/18399/1 "2018-11-27T17:32:49Z")

</div>

Hi Team,

I am trying to test a slack code in post user registration hook with the below code and run via console itself.Its returning the below error.Can any one help me?

Request :  
module.exports = function (user, context, cb) {

var SLACK\_HOOK =“#url”;

// Post the new user’s name and email address to the selected channel  
var slack = require(‘slack-notify’)(SLACK\_HOOK);  
var message = ‘New User: ’ + (user.email) + ’ (’ + user.email + ‘)’;  
var channel = ‘#CHANNEL’;

slack.success({  
text: message,  
channel: channel  
});

console.log(“success”);  
cb(message);  
};

RESPONSE :

```auto
  "message": "New User: user1@foo.com (user1@foo.com)",
  "statusCode": 500,
  "stack": "Error: New User: user1@foo.com (user1@foo.com)\n at respondWithError (/data/sandbox/node_modules/auth0-ext-compilers/lib/adapter.js:11:17)\n at buildResponse (/data/sandbox/node_modules/auth0-ext-compilers/lib/adapter.js:96:24)\n at func (/data/sandbox/node_modules/auth0-ext-compilers/lib/compilers/user-registration.js:31:20)\n at module.exports (/data/io/27e9ebc9-6a28-4784-a88d-85492b8359eb/webtask.js:19:3)\n at Authz.is_authorized.error (/data/sandbox/node_modules/auth0-ext-compilers/lib/compilers/user-registration.js:30:16)\n at Object.is_authorized (/data/sandbox/node_modules/auth0-ext-compilers/lib/authorization.js:13:81)\n at userRegistrationHandler (/data/sandbox/node_modules/auth0-ext-compilers/lib/compilers/user-registration.js:9:18)\n at parseBody (/data/sandbox/node_modules/auth0-ext-compilers/lib/adapter.js:90:20)\n at finish (/data/sandbox/node_modules/auth0-ext-compilers/node_modules/wreck/lib/index.js:369:16)\n at wrapped (/data/sandbox/node_modules/auth0-ext-compilers/node_modules/hoek/lib/index.js:879:20)"
}

```

Please can any one help?

---

<div class="post-metadata">

**Author:** ![charsleysa](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/charsleysa/32/9722_2.png) [@charsleysa](https://community.auth0.com/u/charsleysa)\
**Post date:** [November 29, 2018, 7:37am UTC](https://community.auth0.com/t/post-user-registration-hook-returning-data-sandbox-node-modules-error/18399/2 "2018-11-29T07:37:18Z")

</div>

Hi @shilpa.c.kumar

Your issue is that you are using the `cb` (or `callback`) parameter incorrectly.  
The `callback` parameter is a function which takes in three parameters, it has the following method signature:  
`function (error, user, context)`

This means that if you pass a non-null value as the first parameter (as you are doing with `cb(message);`) it will be treated like the rule has failed.

If your rule succeeds then the callback should be called as so in your code:  
`cb(null, user, context);`

For more information about rules you can find the [docs here](https://auth0.com/docs/rules/current).

---

<div class="post-metadata">

**Author:** ![shilpa.c.kumar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/shilpa.c.kumar/32/9806_2.png) [@shilpa.c.kumar](https://community.auth0.com/u/shilpa.c.kumar)\
**Post date:** [December 7, 2018, 11:30am UTC](https://community.auth0.com/t/post-user-registration-hook-returning-data-sandbox-node-modules-error/18399/3 "2018-12-07T11:30:28Z")

</div>

Thanks [charsleysa] issue is resovled now. 🙂

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 10, 2018, 2:11pm UTC](https://community.auth0.com/t/post-user-registration-hook-returning-data-sandbox-node-modules-error/18399/4 "2018-12-10T14:11:58Z")

</div>

Thanks a lot @charsleysa 👏🏼👏🏼👏🏼👏🏼

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [January 9, 2019, 2:11pm UTC](https://community.auth0.com/t/post-user-registration-hook-returning-data-sandbox-node-modules-error/18399/5 "2019-01-09T14:11:58Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
