gatsby: undefined is not an object (evaluating 'r.page')

Description

We run a highly-trafficked Gatsby site in production. Recently, we’ve begun seeing a massive uptick in these errors reported by our error monitoring tool (Sentry): undefined is not an object (evaluating 'r.page'). This happened after we updated Gatsby from v2.17.7 to v2.18.17.

You can find a few of the stack traces here:

These errors occur exclusively for older versions of Chrome on Windows devices. This would seem to point to a polyfill issue, except for the fact that we cannot reproduce it ourselves and even older Chrome versions still have great support for modern JS.

Example browsers (all on Windows XP, Vista, 7, 8, 8.1, or 10):

  • Chrome 50.0.2661
  • Chrome 56.0.2924
  • Chrome 61.0.3163

In the past, we’ve found errors like these generally correspond to some issue successfully loading the page-data.json file corresponding to a given page. I don’t think anyone will be able to tell us exactly what’s happening here, but if there are any Gatsby folks who would be able to point us in the direction of what this r.page refers to or might know of any similar issues that could be related, we’d very much appreciate it! Please let us know if any further information might be useful.

Steps to reproduce

We have not been able to reproduce this ourselves. Our website is DataCamp.com if you’d like to give it a shot.

Expected result

We should not be receiving thousands of errors.

Actual result

We are receiving thousands of errors.

Environment

Output of gatsby info --clipboard:

  System:
    OS: macOS High Sierra 10.13.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 11.0.0 - ~/.nvm/versions/node/v11.0.0/bin/node
    Yarn: 1.10.1 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v11.0.0/bin/npm
  Languages:
    Python: 2.7.10 - /usr/bin/python
  Browsers:
    Chrome: 79.0.3945.88
    Firefox: 59.0.2
    Safari: 13.0.4
  npmPackages:
    gatsby: ^2.18.17 => 2.18.17 
    gatsby-image: ^2.2.37 => 2.2.37 
    gatsby-plugin-canonical-urls: ^2.1.15 => 2.1.15 
    gatsby-plugin-portal: ^1.0.7 => 1.0.7 
    gatsby-plugin-purgecss: ^4.0.1 => 4.0.1 
    gatsby-plugin-react-helmet: ^3.1.15 => 3.1.15 
    gatsby-plugin-react-svg: ^2.1.2 => 2.1.2 
    gatsby-plugin-sass: ^2.1.26 => 2.1.26 
    gatsby-plugin-sentry: ^1.0.1 => 1.0.1 
    gatsby-plugin-sharp: ^2.3.8 => 2.3.8 
    gatsby-source-apiserver: ^2.1.4 => 2.1.4 
    gatsby-source-filesystem: ^2.1.42 => 2.1.42 
    gatsby-source-graphql: ^2.1.29 => 2.1.29 
    gatsby-source-greenhouse-job-board: ^1.0.3 => 1.0.3 
    gatsby-transformer-sharp: ^2.3.9 => 2.3.9 
    gatsby-transformer-yaml: ^2.2.20 => 2.2.20 
  npmGlobalPackages:
    gatsby-cli: 2.7.40

cc @dandenney @thomascorthouts @slin12

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 18 (11 by maintainers)

Most upvoted comments

We are also seeing this error in Sentry a lot for some of our pages on 8fit.com, on various devices and browsers. We’re currently on v2.19.5

I just tried opening my gatsby site on an older device (iPhone 5S) Safari 7 And got the same issue in the dev tools

@dandenney only one user on sentry

Happens on page load for us on iPhone running iOS 10.3.3. Note: was not able to reproduce on browserstack with iOS 10, but with iOS 7 it did throw: undefined is not an object (evaluating ‘r.page’). This results in users seeing a blank page. They do see the static HTML for a split second, but as soon as JS takes over…its over.

We also get this on bold.org version 2.19.14

Just seeing @antoinerousseau’s edit now:

Edit: actually it seems to only happen in various Chrome versions, in various Windows versions.

This is what’s happening to us also, and it’s incredibly confusing. Perhaps some sort of windows-specific browser extension / adblocker / security software that’s e.g. interfering with the page-data.json file loading?

I just got this on v2.15.24

@benawad Were you able to reproduce it or was it only in Sentry?

I just got this on v2.15.24

We have not been able to reproduce.

Sorry to hear you’re running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you’re able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

If you’re up for it, we’d very much appreciate if you could provide a minimal reproduction and we’ll be able to take another look.

Thanks for using Gatsby! 💜

Same issue here at https://atelierschuteslibres.com/ in Gatsby v2.17

window.onerror · TypeError: undefined is not an object (evaluating 'r.page')
https://atelierschuteslibres.com/app-83c1abcf7ffa2be02805.js:1

Happening in various browsers and OS.

  System:
    OS: macOS 10.15.2
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.12.0 - ~/.nvm/versions/node/v10.15.3/bin/npm
  Languages:
    Python: 2.7.17 - /usr/local/bin/python
  Browsers:
    Chrome: 79.0.3945.117
    Firefox: 71.0
    Safari: 13.0.4
  npmPackages:
    gatsby: ^2.17.15 => 2.17.15
    gatsby-image: ^2.2.33 => 2.2.33
    gatsby-plugin-google-analytics: ^2.1.27 => 2.1.27
    gatsby-plugin-manifest: ^2.2.28 => 2.2.28
    gatsby-plugin-netlify: ^2.1.25 => 2.1.25
    gatsby-plugin-offline: ^3.0.21 => 3.0.21
    gatsby-plugin-react-helmet: ^3.1.15 => 3.1.15
    gatsby-plugin-sharp: ^2.3.0 => 2.3.0
    gatsby-plugin-sitemap: ^2.2.21 => 2.2.21
    gatsby-plugin-styled-components: ^3.1.13 => 3.1.13
    gatsby-plugin-typescript: ^2.1.18 => 2.1.18
    gatsby-source-contentful: ^2.1.59 => 2.1.59
    gatsby-source-filesystem: ^2.1.37 => 2.1.37
    gatsby-transformer-inline-svg: ^0.0.1 => 0.0.1
    gatsby-transformer-sharp: ^2.3.5 => 2.3.5

Edit: actually it seems to only happen in various Chrome versions, in various Windows versions.

Also, potentially relevant: we use @DSchau’s awesome assetPrefix feature.