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

Server returns a 500 error for GET request of Automatic Persisted Query #142

Open
ikenox opened this issue Aug 24, 2023 · 0 comments
Open

Comments

@ikenox
Copy link

ikenox commented Aug 24, 2023

Minimal reproducible example

  1. Start server

    git clone https://github.com/ikenox/apollo-server-integration-next-example.git
    cd apollo-server-integration-next-example
    npm install
    npm run dev
  2. Request Automatic Persisted Query

    According to https://www.apollographql.com/docs/apollo-server/performance/apq/#command-line-testing ,

    curl --get http://localhost:4000/graphql \
      --header 'content-type: application/json' \
      --data-urlencode 'extensions={"persistedQuery": {"version":1,"sha256Hash":"ecf4edb46db40b5132295c0291d62fb65d6759a9eedfa4d5d612dd5ec54a6b38"}}'
    
  3. 500 Internal Server Error is returned

    getBody seems to try to parse an empty body as JSON string.

    - error SyntaxError: Unexpected end of JSON input
        at JSON.parse (<anonymous>)
        at parseJSONFromBytes (node:internal/deps/undici/undici:6662:19)
        at successSteps (node:internal/deps/undici/undici:6636:27)
        at specConsumeBody (node:internal/deps/undici/undici:6642:9)
        at NextRequest.json (node:internal/deps/undici/undici:6533:18)
        at eval (webpack-internal:///(rsc)/./node_modules/@as-integrations/next/dist/lib/getBody.js:140:78)
        at step (webpack-internal:///(rsc)/./node_modules/@as-integrations/next/dist/lib/getBody.js:107:23)
        at Object.eval [as next] (webpack-internal:///(rsc)/./node_modules/@as-integrations/next/dist/lib/getBody.js:48:20)
        at eval (webpack-internal:///(rsc)/./node_modules/@as-integrations/next/dist/lib/getBody.js:26:71)
        at new Promise (<anonymous>)
        at __awaiter (webpack-internal:///(rsc)/./node_modules/@as-integrations/next/dist/lib/getBody.js:8:12)
        at getBody (webpack-internal:///(rsc)/./node_modules/@as-integrations/next/dist/lib/getBody.js:130:12)
        at eval (webpack-internal:///(rsc)/./node_modules/@as-integrations/next/dist/startServerAndCreateNextHandler.js:218:51)
        at step (webpack-internal:///(rsc)/./node_modules/@as-integrations/next/dist/startServerAndCreateNextHandler.js:107:23)
        at Object.eval [as next] (webpack-internal:///(rsc)/./node_modules/@as-integrations/next/dist/startServerAndCreateNextHandler.js:48:20)
        at eval (webpack-internal:///(rsc)/./node_modules/@as-integrations/next/dist/startServerAndCreateNextHandler.js:26:71)
        at new Promise (<anonymous>)
        at __awaiter (webpack-internal:///(rsc)/./node_modules/@as-integrations/next/dist/startServerAndCreateNextHandler.js:8:12)
        at handler (webpack-internal:///(rsc)/./node_modules/@as-integrations/next/dist/startServerAndCreateNextHandler.js:203:16)
        at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:254:43)
        at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/trace/tracer.js:111:36)
        at NoopContextManager.with (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:360:30)
        at ContextAPI.with (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:30:58)
        at NoopTracer.startActiveSpan (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:953:34)
        at ProxyTracer.startActiveSpan (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:993:36)
        at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/trace/tracer.js:100:107)
        at NoopContextManager.with (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:360:30)
        at ContextAPI.with (webpack-internal:///(rsc)/./node_modules/next/dist/compiled/@opentelemetry/api/index.js:30:58)
        at NextTracerImpl.trace (webpack-internal:///(rsc)/./node_modules/next/dist/server/lib/trace/tracer.js:100:32)
        at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:242:53)
        at AsyncLocalStorage.run (node:async_hooks:346:14)
        at Object.wrap (webpack-internal:///(rsc)/./node_modules/next/dist/server/async-storage/static-generation-async-storage-wrapper.js:42:24)
        at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:196:97)
        at AsyncLocalStorage.run (node:async_hooks:346:14)
        at Object.wrap (webpack-internal:///(rsc)/./node_modules/next/dist/server/async-storage/request-async-storage-wrapper.js:82:24)
        at eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:195:75)
        at AsyncLocalStorage.run (node:async_hooks:346:14)
        at AppRouteRouteModule.execute (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:192:56)
        at AppRouteRouteModule.handle (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:315:41)
        at doRender (/Users/naoto.ikeno/repos/github.com/ikenox/apollo-server-integration-next-example/node_modules/next/dist/server/base-server.js:1091:56)
        at cacheEntry.responseCache.get.incrementalCache.incrementalCache (/Users/naoto.ikeno/repos/github.com/ikenox/apollo-server-integration-next-example/node_modules/next/dist/server/base-server.js:1300:34)
        at /Users/naoto.ikeno/repos/github.com/ikenox/apollo-server-integration-next-example/node_modules/next/dist/server/response-cache/index.js:99:42
        at ResponseCache.get (/Users/naoto.ikeno/repos/github.com/ikenox/apollo-server-integration-next-example/node_modules/next/dist/server/response-cache/index.js:149:11)
        at DevServer.renderToResponseWithComponentsImpl (/Users/naoto.ikeno/repos/github.com/ikenox/apollo-server-integration-next-example/node_modules/next/dist/server/base-server.js:1219:53)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async DevServer.renderPageComponent (/Users/naoto.ikeno/repos/github.com/ikenox/apollo-server-integration-next-example/node_modules/next/dist/server/base-server.js:1451:24)
        at async DevServer.renderToResponseImpl (/Users/naoto.ikeno/repos/github.com/ikenox/apollo-server-integration-next-example/node_modules/next/dist/server/base-server.js:1495:32)
        at async DevServer.pipeImpl (/Users/naoto.ikeno/repos/github.com/ikenox/apollo-server-integration-next-example/node_modules/next/dist/server/base-server.js:735:25)
        at async DevServer.handleCatchallRenderRequest (/Users/naoto.ikeno/repos/github.com/ikenox/apollo-server-integration-next-example/node_modules/next/dist/server/next-server.js:703:13)
        at async DevServer.handleRequestImpl (/Users/naoto.ikeno/repos/github.com/ikenox/apollo-server-integration-next-example/node_modules/next/dist/server/base-server.js:647:17)
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant