I have a hapi.js route where I want to defer the response. I\'ve tried storing the reply function and calling it later, or wrapping it in a promise, but hapi alway
reply
If an error is thrown within your handler, hapi.js will immediately exit and give a 500 status code. Check if generateId() is a valid function.
hapi.js
500
generateId()
The rest of your code looks right for your third and fourth examples. reply().hold() is necessary to keep the connection open after handler returns.
reply().hold()
handler