Uncaught (in promise) Error: GraphQL error: Cannot read property 'id' of null
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- graphql, javascript
Research direction
Start with the reproduction steps for a new user and inspect src/datasources/user.js around line 35, where this.context.user.id is accessed. Trace how the guest user is cached during Book All, then verify that the flow no longer raises the reported GraphQL error for users without an email.
Written by the indexing model from the issue text.
Description
Steps to reproduce:
- Login as a new user (hasn't entered their email yet)
- Select a trip from the home page
- Add trip to cart
- Go to cart
- Click Book All
It will explode with: Uncaught (in promise) Error: GraphQL error: Cannot read property 'id' of null.
Looking at the error more closely reveals that we are caching the guest user somewhere. The error comes back from
// src/datasources/user.js:35
const userId = this.context.user.id;
if (!userId) return;
This means the user context is null
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 808
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apollographql/fullstack-tutorial
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
investigate
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
documentation
apollographql/fullstack-tutorial#285 · 3 comments · 1 assignee ·
-
investigate
Difficulty 3/5 1-2 days Newbie friendliness 35/100
apollographql/fullstack-tutorial#255 · 2 reactions ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 25/100
apollographql/fullstack-tutorial#254 · 2 comments ·
All issues in apollographql/fullstack-tutorial
Similar issues
-
blocklist removal
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
pastelsky/bundlephobia#1122 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100