gatsby: Gatsby V3: Error: "performance.mark is not a function" on Safari <= 10.1

Preliminary Checks

Description

Since we migrated to Gatsby V3 from V2 we have seen that a lot of our visitors are getting the following error performance.mark is not a function when visiting our site. It seems to be that performance.mark was introduced in Safari 10.2 (https://caniuse.com/?search=performance.mark)

Reproduction Link

https://github.com/gatsbyjs/gatsby-starter-hello-world

Steps to Reproduce

  1. Visit a gatsby V3 site with Safari 10.1 or lower
  2. Watch the error in the console …

Expected Result

Before calling performance.mark gatsby should check if that function exists (or add a polyfill for it), i.e not to throw an error when it doesn’t exist

Actual Result

An error is thrown

Environment

System:
    OS: macOS 11.4
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.15.1 - ~/.nvm/versions/node/v14.15.1/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.6.3 - ~/.nvm/versions/node/v14.15.1/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 91.0.4472.114
    Safari: 14.1.1
  npmPackages:
    gatsby: 3.7.2 => 3.7.2 
    gatsby-plugin-google-marketing-platform: ^0.2.0 => 0.2.0 
    gatsby-plugin-image: ^1.7.1 => 1.7.1 
    gatsby-plugin-polyfill-io: ^1.1.0 => 1.1.0 
    gatsby-plugin-react-helmet: 4.7.1 => 4.7.1 
    gatsby-plugin-react-svg: ^3.0.0 => 3.0.1 
    gatsby-plugin-robots-txt: ^1.6.2 => 1.6.2 
    gatsby-plugin-s3: ^0.3.8 => 0.3.8 
    gatsby-plugin-sass: 4.7.1 => 4.7.1 
    gatsby-plugin-sharp: 3.7.1 => 3.7.1 
    gatsby-plugin-sitemap: 2.12.0 => 2.12.0 
    gatsby-plugin-styled-components: 4.7.1 => 4.7.1 
    gatsby-plugin-ts-config: 1.1.5 => 1.1.5 
    gatsby-source-filesystem: 3.7.1 => 3.7.1 
    gatsby-transformer-sharp: 3.7.1 => 3.7.1 
    gatsby-transformer-yaml: 3.7.1 => 3.7.1

Config Flags

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Actually no, this can’t be solved by polyfilling anyway. The fix is to check for it first, I’ll put a PR in tonight.

Fixed in v3.12.0. Thanks @herecydev!

@LekoArts Could this be re-opened?