Apollo Core: TypeError: response.http.headers is not iterable
See original GitHub issuePackage: apollo-server-core@2.9.0 Expected Behavior: Well I’m not sure what to expect.
Actual Behavior: These lines in apollo-server-core are stopping my application from returning payloads to the client.
I receive the following stacktrace:
"TypeError: response.http.headers is not iterable",
" at /Users/<ommited>/Documents/<ommited>/<ommitted>/node_modules/apollo-server-core/src/runHttpQuery.ts:311:49",
" at Generator.next (<anonymous>)",
" at fulfilled (/Users/<ommited>/Documents/<ommited>/<ommitted>/node_modules/apollo-server-core/dist/runHttpQuery.js:4:58)",
" at process._tickCallback (internal/process/next_tick.js:68:7)"
When I comment out those 4 lines of code everything works normally.
I have logged what the headers look like at that point and they are the following: Headers { _headers: {} }
Seems to be some class instance of headers however, the way that the core package tries to iterate over the headers causes a type error to be thrown.
I am using apollo-server-express. Any hints as to why its unable to interface with the headers correctly?
This is the minimum code example needed to reproduce:
const app = express();
import { ApolloServer } from 'apollo-server-express';
const server = new ApolloServer({
schema: schema,
formatError: (err) =>{
console.log(err);
return err;
},
context: async ({ req, res, ...rest }, ...other) => {
return {
hi: 5
}
},
introspection: true,
tracing: false,
cacheControl: false
});
server.applyMiddleware({ app, path: '/api', cors: corsOptions });
const httpServer = createServer(app);
httpServer.listen(PORT, () => console.log('GraphQL API running at http://localhost:3001/api'));
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Types is not iterable - Help - Apollo GraphQL
TypeError : types is not iterable. I make a simple replication of the config I am using for. CodeSandbox – 6 Jun 21 ......
Read more >TypeError: undefined is not iterable (cannot read property ...
just trying to render a list of items obtained from my backend but getting this error indicating it's undefined. However, when I check...
Read more >typeerror: undefined is not iterable (cannot read ... - You.com
My page crashes only when Apollo dev tools is open. Apollo Client Developer Tools version 2.3.2 Chrome browser, Version 86.0.4240.111 (Official Build) (64-bit)....
Read more >Fetch Standard
Any item in list that is not a forbidden response-header name. A no-CORS-safelisted request-header name is a header name that is a byte-case- ......
Read more >TypeScript errors and how to fix them
error TS1192: Module ' json5 ' has no default export. Broken Code ❌. 1, import json5 from 'json5 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To provide a little more clarity, this worked for me by changing my baseUrl from
.
to./
(mildly infuriating, but c’est la vie)@duxtinto
Hey, how are you doing. I’m not sure what it could be in your specific case but in my case my baseUrl in my tsconfig was incorrect.
Which was interesting because my project compiled just fine if i went in the node modules folder and commented out the part where it was getting the "response.http.headers " is not iterable from.
But as soon as the base url was corrected… the issue magically disappeared. I know this was the issue because I pair programmed with a buddy of mine and we just kept making minor edits to the tsconfig until we could get something to work. To this day I can still reproduce the error just by changing the baseUrl.
** Shrugs **
Sorry if this isn’t of any help…