431 Response When Running Pre-registration Hook Example Code

I’m getting a 431 “Request Header Fields Too Large” response status code from Auth0 when testing a new pre-registration hook. To rule out any problems with my code, I’m using a basic example provided by Auth0, and I’m still getting the same behavior:

module.exports = function (user, context, cb) {
  var response = {};

  response.user = user;
  cb(null, response);

So far I have tried:

  • checking that my request headers were not unusually large
  • going through the community forums
  • clearing the browser cache/cookies as suggested in previous threads

Any suggestions would be sincerely appreciated!

Following up on this - we had an environment variable which was very large (greater than ~12,000 characters in length). The presence of this variable correlates with the “Header Fields Too Large” response. However, when we inspected the header fields in dev tools, this environment variable did not appear :exploding_head: . So the true cause is still fuzzy.

We wanted to access a very long CSV list without needing to store it in source control or make an extra API call to retrieve it. The logical answer was an environment variable. Previously, this approach worked perfectly in Rules. But when we decided to port this Rule to a Hook, we saw the 431 error. Storing the list in source seems to be working.

1 Like

Thanks for providing more context on that. I’ll do some digging and let you know once I find something!

This topic was automatically closed after 4 days. New replies are no longer allowed.