Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redirecting in onRequest throws Cannot read property 'isOriginMatch' of null #3813

Closed
jgallen23 opened this issue Aug 15, 2018 · 2 comments
Closed
Assignees
Labels
bug Bug or defect
Milestone

Comments

@jgallen23
Copy link

We have a https redirect plugin that onRequest, if not https, then redirect to https (https://github.com/bendrucker/hapi-require-https). As of 17.5.3, this causes the server to crash. I pinned our server back to 17.5.2 and there was no issue.

Here is example stack trace

(node:24804) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'isOriginMatch' of null
    at exports.headers (/home/nicolas/dev/yellow/mistertracer/mistertracer-server/node_modules/hapi/lib/cors.js:171:28)
    at Object.internals.marshal (/home/nicolas/dev/yellow/mistertracer/mistertracer-server/node_modules/hapi/lib/transmit.js:46:24)
    at Object.exports.send (/home/nicolas/dev/yellow/mistertracer/mistertracer-server/node_modules/hapi/lib/transmit.js:31:25)
    at Request._reply (/home/nicolas/dev/yellow/mistertracer/mistertracer-server/node_modules/hapi/lib/request.js:349:24)
    at <anonymous>
(node:24804) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:24804) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

more context: outmoded/discuss#704

@mariecl
Copy link
Contributor

mariecl commented Aug 20, 2018

I am also experiencing this issue.

In my case, one route handler calls the handler of another route under certain conditions. When those conditions are met, the "redirect" happens and I get the same TypeError.

@devinivy devinivy added the bug Bug or defect label Aug 21, 2018
@hueniverse hueniverse added this to the 17.5.3 milestone Aug 28, 2018
@hueniverse hueniverse self-assigned this Aug 28, 2018
@hueniverse hueniverse modified the milestones: 17.5.3, 17.5.4 Aug 28, 2018
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

4 participants