Open
Description
Trying to use response caching with Cloudflare workers and KV. Cache entries are created in KV, but cache never hit and in Cloudflare console i can see that cached data is empty json ({}
).
Config:
sources:
- name: TheGraph
handler:
graphql:
endpoint: '{{&GRAPHQL_ENDPOINT}}'
- name: Pinata
handler:
jsonSchema:
endpoint: 'https://sni.mypinata.cloud/'
operations:
- type: Query
field: ipfsMetadata
path: /ipfs/{args.cid}
method: GET
responseSchema: ./json-schemas/metadata.json
operationHeaders:
x-pinata-gateway-token: '{{&PINATA_TOKEN}}'
transforms:
- resolversComposition:
mode: bare
compositions:
- resolver: 'Query.ipfsMetadata'
composer: './middleware/getCid.ts'
additionalTypeDefs: |
extend type SNI {
metadata: Identifier_Token_Metadata
}
additionalResolvers:
- targetTypeName: SNI
targetFieldName: metadata
sourceName: Pinata
sourceTypeName: Query
sourceFieldName: ipfsMetadata
requiredSelectionSet: |
{
tokenURI
}
sourceArgs:
cid: '{root.tokenURI}'
plugins:
- responseCache:
includeExtensionMetadata: true
cache:
cfwKv:
namespace: MESH
Deployed gateway - https://gateway-staging.sovereignnature.ch/graphql
.
Example response:
{
"data": {
"sni": {
"id": "0x0"
}
},
"extensions": {
"responseCache": {
"hit": false,
"didCache": true,
"ttl": null
}
}
}
Metadata
Metadata
Assignees
Labels
No labels