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

Fix Micro server handler #401

Merged
merged 4 commits into from
Jun 16, 2017
Merged

Fix Micro server handler #401

merged 4 commits into from
Jun 16, 2017

Conversation

megamaddu
Copy link
Contributor

The handler was not returning httpRunQuery's Promise, causing micro to send empty responses and leaving Node with unhandled Promise rejections when that Promise tried to write headers.

I also used return and throw instead of manipulating the response directly. This allows wrapping middleware to intercept responses if desired.

@apollo-cla
Copy link

@spicydonuts: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

Copy link
Contributor

@DxCx DxCx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍
however since i didnt test it and im not really familiar with micro,
@nnance can you please also review?

@DxCx DxCx requested a review from nnance May 24, 2017 08:28
Copy link
Contributor

@helfer helfer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spicydonuts thanks a lot for the PR, this looks great! Since the PR is supposed to fix issues, please make sure to add tests for what you changed. That way we can be sure that it works and stays working.

@megamaddu
Copy link
Contributor Author

Good idea. I've added microrouter to the test to demonstrate a more realistic app configuration. This also reveals the underlying issue. If you copy this version of the test into the latest release many tests will fail.

@megamaddu
Copy link
Contributor Author

And now I'm going to go PR all and custom route helpers into microrouter.. lol

@megamaddu
Copy link
Contributor Author

Not really sure why the build failed.. it doesn't appear related to these changes. The node 6 build passed but the node 4 and 7 builds failed with nodejs: not found.

@megamaddu
Copy link
Contributor Author

I'm tempted to touch one of the files to get Travis to re-run. Anyone able to do that without a new commit?

@helfer
Copy link
Contributor

helfer commented Jun 7, 2017

Hi @spicydonuts I've restarted the CI jobs in question. Let's hope they pass this time! 🙂

@megamaddu
Copy link
Contributor Author

Success! 🎉

The handler was not returning `httpRunQuery`'s Promise, causing micro to send empty responses and leaving Node with unhandled Promise rejections when that Promise tried to write headers.

I also used `return` and `throw` instead of manipulating the response directly.  This allows wrapping middleware to intercept responses if desired.
Adding @types/micro caused the test to stop compiling.  Adjusted the import to fix.
@megamaddu
Copy link
Contributor Author

Is there anything blocking this merge? I fixed the merge conflict that's appeared in the meantime.

@helfer
Copy link
Contributor

helfer commented Jun 15, 2017

Hey @spicydonuts, thanks for the reminder, I'll take another look today!

Copy link
Contributor

@helfer helfer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @spicydonuts sorry for the delay and thanks for the PR! Everything looks good to me, I'll merge it now! 🙂

@helfer helfer merged commit 49dff93 into apollographql:master Jun 16, 2017
@helfer helfer mentioned this pull request Jun 16, 2017
@luisrudge
Copy link

is this released? 😛

@helfer
Copy link
Contributor

helfer commented Jun 17, 2017

@luisrudge yes

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants