apollographql / apollographql/fullstack-tutorial
Uncaught (in promise) Error: GraphQL error: Cannot read property 'id' of null
Open
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 808
- PR merge metrics
- No merged PRs in 30d
Description
Steps to reproduce:
1. Login as a new user (hasn't entered their email yet)
2. Select a trip from the home page
3. Add trip to cart
4. Go to cart
5. 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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.