gatsby: Navigating from 404 page errors on production deployment

When a user attempts to navigate from the 404 page on a production build, the console shows this error and the page never redirects:

Uncaught TypeError: Cannot read property 'push' of undefined
    at eventHandler (production-app.js:51)
    at mitt.js:1
    at Array.map (<anonymous>)
    at Object.emit (mitt.js:1)
    at done (loader.js:284)
    at loader.js:295
    at loader.js:95
    at loader.js:78
    at index.js?d7c6:11
    at handler (patch.js:18)

or, if content for the desired destination is already loaded:

Cannot read property 'push' of undefined
    at navigateTo (production-app.js:66)
    at t.navigateTo (index.js:154)
    at gatsby-browser.js:12
    at catch-links.js:51

404.js

import React from 'react';
import Link from 'gatsby-link';

const NotFoundPage = () =>
  <div>
    <h1>NOT FOUND</h1>
    <Link to={`/`}>Click here to go home</Link>
  </div>;

export default NotFoundPage;

dependency versions:

"gatsby": "^1.8.11",
"gatsby-link": "^1.6.7",
"gatsby-plugin-catch-links": "^1.0.4",

About this issue

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

Most upvoted comments

That’d be great!

On Sat, Oct 28, 2017, 6:36 PM Emmanuel Fallancy notifications@github.com wrote:

@KyleAMathews https://github.com/kyleamathews I can get this done if you don’t mind 😃 This particularly happened when there’s no history being pushed to window.___history

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/gatsbyjs/gatsby/issues/1838#issuecomment-340231314, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEVhx74TnYQtMCmOpE_ykrpSH4DJT3vks5sw9apgaJpZM4O5aAe .

@KyleAMathews I can get this done if you don’t mind 😃 This particularly happened when there’s no history being pushed to window.___history

same here; some more info; quite critical because once the user lands on a 404, he can never navigate again

capture d ecran 2017-10-06 a 11 47 09 capture d ecran 2017-10-06 a 11 47 21

The error is happening in https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/cache-dir/production-app.js

Follow the contributing instructions so you can develop against the checked out version of Gatsby and start adding console.logs to understand why there’s the failure.