Open
Description
Issue workflow progress
Progress of the issue based on the
Contributor Workflow
- 1. The issue provides a
minimal reproduction available on
Stackblitz.- Please install the latest
@envelop/*
packages that you are using. - Please make sure the reproduction is as small as possible.
- Please install the latest
- 2. A failing test has been provided
- 3. A local solution has been provided
- 4. A pull request is pending review
Describe the bug
The response cache plugin for Cloudflare KV Store(@envelop/response-cache-cloudflare-kv
). Is not working as expected. There seems to be an internal type mismatch which leads to the following error messages below:
Typescript error during development
Type '(ctx: { MY_KV_STORE: KVNamespace<string>; } & { waitUntil(promise: Promise<unknown>): void; }) => Cache' is not assignable to type 'Cache'.ts(2322)
index.d.ts(9, 5): The expected type comes from property 'cache' which is declared here on type 'UseResponseCacheParameter<YogaInitialContext>'
Runtime error
✘ [ERROR] ERR TypeError: cache2.get is not a function
at responseWithSymbol
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@graphql-yoga/plugin-response-cache/esm/index.js:101:59)
at _handleMaybePromise
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected]/node_modules/@whatwg-node/promise-helpers/esm/index.js:6:24)
at handleMaybePromise
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected]/node_modules/@whatwg-node/promise-helpers/esm/index.js:19:16)
at null.<anonymous>
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@graphql-yoga/plugin-response-cache/esm/index.js:101:28)
ERR TypeError: cache2.get is not a function
at responseWithSymbol
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@graphql-yoga/plugin-response-cache/esm/index.js:101:59)
at _handleMaybePromise
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected]/node_modules/@whatwg-node/promise-helpers/esm/index.js:6:24)
at handleMaybePromise
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected]/node_modules/@whatwg-node/promise-helpers/esm/index.js:19:16)
at null.<anonymous>
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@graphql-yoga/plugin-response-cache/esm/index.js:101:28)
[wrangler:inf] POST /graphql 500 Internal Server Error (104ms)
✘ [ERROR] ERR TypeError: cache2.get is not a function
at responseWithSymbol
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@graphql-yoga/plugin-response-cache/esm/index.js:101:59)
at _handleMaybePromise
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected]/node_modules/@whatwg-node/promise-helpers/esm/index.js:6:24)
at handleMaybePromise
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected]/node_modules/@whatwg-node/promise-helpers/esm/index.js:19:16)
at null.<anonymous>
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@graphql-yoga/plugin-response-cache/esm/index.js:101:28)
✘ [ERROR] ERR TypeError: cache2.get is not a function
at responseWithSymbol
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@graphql-yoga/plugin-response-cache/esm/index.js:101:59)
at _handleMaybePromise
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected]/node_modules/@whatwg-node/promise-helpers/esm/index.js:6:24)
at handleMaybePromise
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected]/node_modules/@whatwg-node/promise-helpers/esm/index.js:19:16)
at null.<anonymous>
(file:///workspaces/response-cache-repoduction/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@graphql-yoga/plugin-response-cache/esm/index.js:101:28)
To Reproduce Steps to reproduce the behavior:
- Set up a project following the details here
Expected behavior
Expected the types to match
Environment:
- OS: Debian GNU/Linux 12 (bookworm) via Docker(WSL)
- NodeJS: v22.14.10
@envelop/*
versions:"@envelop/response-cache-cloudflare-kv": "^3.1.3"
Additional context
- Stackblitz reproduction can be found here
- Possible relation to issue [CloudflareKVPlugin]: Incompatible types when passing in argument for kv #2104
- Tried solutions in issue above. Such as removing the global definition of cloudflare types from tsconfig.json
Metadata
Metadata
Assignees
Labels
No labels