question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

apollo-server-lambda: TypeError: Cannot read property 'endsWith' of undefined

See original GitHub issue

Using the playground, when try to load the page, this error is outputed:

TypeError: Cannot read property 'endsWith' of undefined

Seems to be the case of not every time or at least not at the first request that the event have the path attribute.

https://github.com/apollographql/apollo-server/blob/66f48b88e0d9c8eef123154a3c7dd36a48320fbb/packages/apollo-server-lambda/src/ApolloServer.ts#L176

I printed the event object and could not find the path attribute.

{
  headers: {
    host: 'localhost:4000',
    connection: 'keep-alive',
    'content-length': '1468',
    accept: '*/*',
    'apollo-query-plan-experimental': '1',
    'x-apollo-tracing': '1',
    'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36',
    'content-type': 'application/json',
    origin: 'http://localhost:4000',
    'sec-fetch-site': 'same-origin',
    'sec-fetch-mode': 'cors',
    'sec-fetch-dest': 'empty',
    referer: 'http://localhost:4000/',
    'accept-encoding': 'gzip, deflate, br',
    'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8,pt;q=0.7,de;q=0.6'
  },
  multiValueHeaders: {},
  body: '{...}',
  httpMethod: 'POST'
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
glassercommented, Mar 10, 2021

Good to know! Thanks for double-checking.

1reaction
glassercommented, Mar 9, 2021

Uh-oh, this looks like a regression in v2.21.1 from #4892. I bet a little question mark should fix that up.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apollo Gateway on AWS Lambda Cannot read property ...
I'm not doing anything with uploading, but looking at ApolloServer.js, I can see a handler is made. My index.js looks like this: const...
Read more >
Cannot read property 'launchAPI' of undefined in Apollo ...
I'm trying the following query in Apollo Graphql Studio while checking the tutorial. However, It then indicates the error message, “Cannot read property...
Read more >
apollo-server | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Cannot read property 'endsWith' of undefined - Bountysource
Uncaught TypeError: Cannot read property 'endsWith' of undefined · [X] MaterialDesignFrameworkModule — Material Design · [ ] ...
Read more >
— Adam Freeman - NIBM eHub
editorial fashion and to the benefit of the trademark owner, with no intention of ... Uncaught TypeError: Cannot read property 'setState' of undefined....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found