0

My Apollo Server's resolver has a different return value than the response. I assume that the problem is caching. The E-Tag stays the same since 2 hours, I guess. I have an apollo Server and an apollo client via react.

HTTP-Headers

General

Request URL: http://localhost:4000/graphql
Request Method: POST
Status Code: 200 OK
Remote Address: [::1]:4000
Referrer Policy: strict-origin-when-cross-origin

Respones Headers

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json; charset=utf-8
Content-Length: 6337
ETag: W/"18c1-wdokS77NALfA227meoG75rLOfag"
Date: Wed, 30 Jun 2021 10:01:41 GMT
Connection: keep-alive
Keep-Alive: timeout=5

Request Headers

POST /graphql HTTP/1.1
Host: localhost:4000
Connection: keep-alive
Content-Length: 1201
sec-ch-ua: " Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"
accept: */*
authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MGQxNWZiMmUzMTgyMzUxM2MyNzEyNGMiLCJlbWFpbCI6InJ1cGVydGJvZ2Vuc3BlcmdlcjIxQGdtYWlsLmNvbSIsImNyZWF0ZURhdGUiOiIyMDIxLTA2LTMwVDA5OjQzOjQ3LjA3OVoiLCJpc0tlZXBTaWduZWRUb2tlbiI6ZmFsc2UsImlhdCI6MTYyNTA0NjIyNywiZXhwIjoxNjI1MDQ5ODI3fQ.7mZM9ZL5Zl6Wden3hRvX6gxcwsCrvUxbsprCNI6VVdc
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36
content-type: application/json
Origin: http://localhost:3000
Sec-Fetch-Site: same-site
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost:3000/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8

What I have tried

Client

Server

Server-side caching:

Query resolver

async getXY(_, { _id }: IGetXY, context, info: GraphQLResolveInfo) {
      info.cacheControl.cacheHint = { maxAge: 0, scope: CacheScope.Private }
[...]
return {...}
}

Behaviour

{
  "question": "60db0a6cc405dd2eb4d1f1dc",
  "Answer": {
    "valBool": false,
    "valString": null,
    "__typename": "Answer"
  },
  "__typename": "Items"
}

Expected

{
  "question": "60db0a6cc405dd2eb4d1f1dc",
  "Answer": {
    "valBool": false,
    "valString": null
  }
}

Expected

ru4ert
  • 754
  • 9
  • 19

0 Answers0