Skip to content

TypeError: Cannot read properties of null (reading 'textContent') #83

@pipech

Description

@pipech

Description

Getting TypeError: Cannot read properties of null (reading 'textContent') error after consecutive reloading.

This error originate from this code JSON.parse(document.getElementById('__NEXT_DATA__').textContent) in node_modules/next/dist/client/index.js

May be it's something to do with async await on _document file.

If I remove csp related from _document file it'll work just fine.

Screenshot

image

Step to reproduce

  1. Goes to https://next-safe-middleware.vercel.app/
  2. Open developer console
  3. Press F5(Refresh) 3 times (It not limited to refresh 3 times, sometime after consecutive loading we'll get this error but refresh 3 times is the most reliable way to reproduce this.
  4. You will get TypeError: Cannot read properties of null (reading 'textContent') error
  5. From here javascript won't work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions