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

Does not work with meteor "apollo" package #18

Closed
matteodem opened this issue Dec 28, 2016 · 20 comments
Closed

Does not work with meteor "apollo" package #18

matteodem opened this issue Dec 28, 2016 · 20 comments

Comments

@matteodem
Copy link

Get following error:

http://localhost:3000/graphql 405 (Method Not Allowed)
HTTPFetchNetworkInterface.fetchFromRemoteEndpoint @ VM8112:73
(anonymous) @ VM8112:90
localhost/:1 Fetch API cannot load http://localhost:3000/graphql. Response for preflight has invalid HTTP status code 405
vue-plugin.js?3c73:207 Error sending the query undefined TypeError: Failed to fetch

Using https://atmospherejs.com/meteor/apollo. Any idea for why the OPTION request needs to be made? Or is that the apollo client that is doing that?

@Akryum
Copy link
Member

Akryum commented Dec 29, 2016

I can't replicate this. I just tested with the latest meteor, latest apollo-client, and I could connect successfully to the meteor server apollo, and to an external graphql server.

Edit: here is a working example.

@matteodem
Copy link
Author

oh, I used a custom frontend (not meteorjs). But thanks for showing me an example, I'll try setting up the config similiarly to how the apollo package does.

@matteodem
Copy link
Author

Try upgrading the npm packages. The problem comes up when I upgrade graphql-tools to 0.8.4

@Akryum
Copy link
Member

Akryum commented Dec 30, 2016

@Akryum Akryum reopened this Dec 30, 2016
@Akryum Akryum closed this as completed Jan 3, 2017
@matteodem
Copy link
Author

I'll test it later today

@matteodem
Copy link
Author

Still doesn't work. Did you already try connecting with apollo-client from a custom webpack project? I can upload the project if it's not reproduceable for you

@Akryum
Copy link
Member

Akryum commented Jan 4, 2017

Yes, I'm working on an official vuejs.org app with Webpack and vue-apollo + an Apollo server.

@Akryum Akryum reopened this Jan 4, 2017
@Akryum
Copy link
Member

Akryum commented Jan 20, 2017

Do you still encounter this issue?

@matteodem
Copy link
Author

Yes... I'll upload the repository again later today and hopefully you can reproduce it.

@Akryum
Copy link
Member

Akryum commented Jan 24, 2017 via email

@matteodem
Copy link
Author

here it is: https://github.com/matteodem/vue-apollo-bug

Simply go once into code/api and code/web-app and do following for each folder:

npm install
npm run dev

Both apps need to be running. The api app is the graphql endpoint and the web-app just a webpack project with vuejs. I get following error when visiting the web app url:

error

@matteodem
Copy link
Author

any success?

@Akryum
Copy link
Member

Akryum commented Jan 25, 2017 via email

@matteodem
Copy link
Author

sure, sorry to stress you

@Akryum
Copy link
Member

Akryum commented Feb 2, 2017

I've tried the app, with the same error. In one of my project with apollo-server, the client makes 2 requests with the OPTIONS method. But the meteor package rejects it, so I wonder if its internal apollo packages are up-to-date.

@Akryum
Copy link
Member

Akryum commented Feb 2, 2017

@matteodem Did you try setting up apollo server manually?

@matteodem
Copy link
Author

no, do you have an example of doing that with meteorjs?

@Akryum
Copy link
Member

Akryum commented Feb 3, 2017

You can get inspiration from this or maybe try to clone the meteor/apollo package and update the dependencies.

@matteodem
Copy link
Author

This has been solved in the meantime, thanks for helping out

@ecerroni
Copy link

Just for reference I had the very same problem although I'm not using meteor. Indeed I'm using the classic vue webpack dev server and an express apollo server.

I solved my problem thanks to this post. I hope it'll help others too facing the same issue:
https://forums.meteor.com/t/solved-cors-errors-with-apollo-on-meteor-1-4x/29465

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants