Return error response when using apollo-server-lambda and apollo-persist-query in netlify functions

My site is https://conduit-graphql.netlify.app/graphql, it’s a netlify function using apollo-server-lambda. And I use apollo-link-http and apollo-persist-query in client. When I use netlify dev in local environment, It’s work normal. But When I deploy to netlify functions, it return error response to persist queries. For example, here is a request, I want get all articles(I have disable the cache) , it should return getAllArticles.


But it return getprofile

{"data":{"getProfile":{"id":"5f041605f60e5b3a005fb0b1","username":"13664","bio":"","image":"","following":false,"__typename":"Profile"}}}

And I try to open the request in a new window, it shows

{
  "errors": Array[1][
    {
      "message": "PersistedQueryNotFound",
      "extensions": {
        "code": "PERSISTED_QUERY_NOT_FOUND"
      }
    }
  ]
}

if it help, my netlify functions code is here https://github.com/jameslahm/conduit-server-graphql
And client code is here https://github.com/jameslahm/conduit-frontend-web/blob/graphql/src/utils/api.ts
Thanks very much!

Hi @jameslahm, welcome to the community.

It looks like you are proxying from /graphql to your netlify function. From experience, I know that when proxying, passing through query strings are not super reliable. Can you try removing the redirect rule in your netlify.toml file and then hitting the function directly (/.netlify/functions/graphql) and see if that works better?