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

[BUG/FR with REPRO] APQ, handling correct GET requests with both Apollo and Urql #1085

Closed
frederikhors opened this issue Sep 24, 2022 · 11 comments
Labels
bug Something isn't working

Comments

@frederikhors
Copy link
Contributor

Hi guys!

I think this is the same problem that @bbigras had (but the Stale BOT closed it without a proper fix).

I created a small reproduction here: https://github.com/frederikhors/iss-async-graphql-apq-urql.git.

In it's README.md you can read:

To start

  • cargo run
  • in another tab cd web && npm install && npm run dev

Problem

If you open the browser (http://localhost:5000) in the console you can read the error:

start.js:312          GET http://localhost:8000/?variables=%7B%7D&extensions=%7B%22persistedQuery%22%3A%7B%22sha256Hash%22%3A%22cde5de0a350a19c59f8ddcd9646e5f260b2a7d5649ff6be8e63e9462934542c3%22%2C%22version%22%3A1%7D%7D 400 (Bad Request)

The backend response is:

Io(Custom { kind: Other, error: "failed to parse graphql request from uri query: invalid type: string \"{}\", expected a map" })

If I remove the line persistedFetchExchange({ preferGetForPersistedQueries: true }) from index.svelte it works (because it's using the POST method now and not the Automatic persisted queries anymore).

Proposal

I think we should fix this because both Apollo & Urql (so the 90% of web projects) use the same API/functioning.

Practically today it is not possible to use this method with async-graphql at all.

Ref

Thank you very much for your work on this amazing project!

@frederikhors frederikhors added the bug Something isn't working label Sep 24, 2022
@frederikhors
Copy link
Contributor Author

@bbigras if you have some news, please help us! Thanks! 😃

@sunli829
Copy link
Collaborator

This problem is due to async-graphql-axum not supporting getting parameters other than query from the query string.

@sunli829
Copy link
Collaborator

Fixed in master branch 🙂

@frederikhors
Copy link
Contributor Author

Wow. It was fast! Can you release so I can try it?

Or how can I try the master branch?

@sunli829
Copy link
Collaborator

Yes,you can try it on master branch,I'll release it later.😄

@frederikhors
Copy link
Contributor Author

Yes,you can try it on master branch,I'll release it later.😄

I asked HOW I can try it. Not if. But I think I found how to.

@sunli829
Copy link
Collaborator

sunli829 commented Sep 25, 2022

{
async-graphql = { git="https://github.com/async-graphql/async-graphql.git", branch="master" }
async-graphql-axum= { git="https://github.com/async-graphql/async-graphql.git", branch="master" }
}

@frederikhors
Copy link
Contributor Author

I tried. I get in my real project many errors. I'll try in the reproduction project right now.

@frederikhors
Copy link
Contributor Author

The reproduction repo works with master branch!

https://github.com/frederikhors/iss-async-graphql-apq-urql/commit/943214929f7fb5218be2d3fddf65dae4621d738a

Thank you very much!

@frederikhors
Copy link
Contributor Author

I look forward to a new release and now I am also trying to understand the problems I have on my real project with the master branch.

@frederikhors
Copy link
Contributor Author

Are you going to release soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants