Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Uncaught (in promise) Error: GraphQL error: Cannot read property 'id' of null

Open
#62 8 comments 0 reactions 0 assignees View on GitHub

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
Domain
api, backend

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:

  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

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apollographql/fullstack-tutorial

All issues in apollographql/fullstack-tutorial

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.