I am attempting to test a post login action via the Management API following the doc at Auth0 Management API v2, but I’m receiving the following error when running this test via the management API:
“Cannot read properties of undefined (reading ‘ip’)”
Full response payload example
{
"payload": {
"error": {
"message": "Cannot read properties of undefined (reading 'ip')",
"name": "TypeError",
"stack": "TypeError: Cannot read properties of undefined (reading 'ip')\n at ry (/data/io/7033255a424689edf5f05062e558ee62106ce287.js:7:2258)\n at md (/data/io/7033255a424689edf5f05062e558ee62106ce287.js:7:2088)\n at /data/io/7033255a424689edf5f05062e558ee62106ce287.js:7:834\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
},
"stats": {
"total_request_duration_ms": 69,
"total_runtime_execution_duration_ms": 66,
"action_duration_ms": 6,
"runtime_external_call_duration_ms": 122,
"boot_duration_ms": 60,
"network_duration_ms": 3
}
}
}
A simple post login action I tested with:
exports.onExecutePostLogin = async (event, api) => {
console.log('foo');
};
I’ve copied the test payload from the test tool and used it for the payload in your Management API explorer. The API doc isn’t specific on how to format the payload, but according to Test Actions, we can use sample payloads from the editor. I formatted it as:
{
"payload": {
"event": <sample json copied from actions editor>
}
}
Running the test within the actions tool works, but running via the api generates the "reading ‘ip’‘’ error. I’m assuming this is an error with the payload, but after trying different formats and manually adding an ‘ip’ parameter to different spots in the payload with no success, I decided to try this test with actions for different flows. Post Login ad Machine to Machine both generate this error using the sample payload I copied for each running tests via the editor. However, all other flows I tested run correctly (pre and post user registration, post send password, send phone message, password reset and post change password). I tried some variations on runtimes, deployed vs undeployed actions, and running these in both a dev and production tenant. Those didn’t appear to make a difference. Only running the actions api test on post login and machine to machine flows gives me this error.
If it matters, I generated auth tokens from the API explorer under the Auth0 Management API in both the dev and production tenants. Also, while the returned json payload displays an error, it does return a 200 status.
Is there a payload formatting I need to add for testing these via the API or some other error I’m making when running these tests?