Apollo Server v4 static persisted queries failing after transition from automatic local mode
0 reputation · 19 Apr 2024, 13:17 UTC
Transitioning from automatic persisted queries to static persisted queries in Apollo Server v4 causes production 'Query not found' errors. In development, the server successfully caches hashes on-the-fly when the client sends full query strings. However, the production environment is configured to rely on a pre-computed mapping file to restrict arbitrary query execution.
Despite having the client-side build manifest containing the correct hashes, the production server fails to resolve operations when the client sends only the persistedQuery hash. This mismatch occurs even when the server de-serialization store is initialized with the manifest and the Redis cache is properly populated during server startup.
- How can we ensure the Apollo Server de-serialization store correctly synchronizes with the build-time manifest in distributed environments?
- What specific configuration is required to ensure the load balancer does not strip the headers necessary for the hash handshake?