Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript errors on index page only after build #3311

Closed
ataylorme opened this issue Dec 22, 2017 · 2 comments
Closed

JavaScript errors on index page only after build #3311

ataylorme opened this issue Dec 22, 2017 · 2 comments
Assignees

Comments

@ataylorme
Copy link

Description

After running gatsby build the resulting site has JavaScript errors on the home/index page only. This happens when clicking links to other pages, such as /about/. The errors seen are production-app.js:72 Uncaught TypeError: Cannot read property 'push' of undefined at e (production-app.js:72) and ReactErrorUtils.js:49 Uncaught TypeError: Cannot read property 'push' of undefined at o (production-app.js:87).

What's odd is I can visit another page, such as /about/ directly and things load fine. From there I can even navigate back to the home page and then to other pages without issue. This also does not happen during gatsby develop

I am using gatsby-link for creating the links in the header between pages. For example, <Link className="link" to="/about/">About</Link>

This can be seen on the site at https://www.ataylor.me and https://www.ataylor.me/about/.

The source code for the site is here. The logs for the most recent run of gatsby build can be found on CircleCI.

Environment

Gatsby version: 1.1.28
Node.js version: 8.8.1
Operating System: macOS High Sierra 10.13.2 (17C88) (locally) and Debian Jessie (CircleCI)

File contents (if changed):

gatsby-config.js
package.json
gatsby-node.js
gatsby-browser.js: not changed
gatsby-ssr.js: not changed

Actual result

Links created with gatsby-link do not work on the home page and throw errors in the browser console.

Expected behavior

The link should work as expected.

Steps to reproduce

1. Visit https://www.ataylor.me

2. Click on any link, such as the About page in the header

3. Witness no page change and view browser console errors

Notes

I've tried destroying and re-creating node_modules and package-lock.json as well as updating gatsby and Node with no luck.

@KyleAMathews
Copy link
Contributor

Thanks for the nice reproduction! I'd heard reports of this before but hadn't been able to reproduce it before. Have a PR up which should make this bug go away finally :-)

@ghost ghost removed the review label Dec 22, 2017
@ataylorme
Copy link
Author

@KyleAMathews thanks for the quick fix! Just deployed this out and can confirm it's working 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants