-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[v2] Pages render briefly then turn blank in non-local environments #7289
Comments
This sounds like the server side rendering is working as expected, but then when the app mounts in the client, it's dropping that div for some reason. You can confirm this by browsing the site in your CI environment with JavaScript disabled. Is your CI a Windows environment? If it is, can you confirm that you see the error in other non-Windows environments? Hmm - there's |
Yep, confirmed that disabling javascript stops the content from getting wiped. Our CI is Windows, yeah. Confirming non-Windows will take some time but I will get back to you on that. I think the |
Through more debugging, I've discovered that the wiping of the root node happens at some point after |
This is still happening for me even after I comment out all plugins, |
Huh... any chance you could publish a repo that demos this problem? |
Make sure to look at your browser console. There's almost certainly a JS error. |
@m-allanson: I started trying to put one together yesterday but so far have been unable to reproduce the issue starting from a fresh project (using @KyleAMathews: No JS errors 😕 |
I think I found the problem! The reason it works locally but not when deployed is because we use a pathPrefix. Here's a repo that reproduces the problem: https://github.com/jrskerritt/gatsby-v2-test All the public files are committed as they would appear in our CI environment, so don't re-run The pathPrefix used to build is Now that I know what's going on, do you guys think this is a bug, or are we copying our static files incorrectly? |
Oh good sleuthing! That is definitely an unintended usage of the pathPrefix - interesting that it works enough to to have no JS errors and no failed requests. I think this should output an error of some kind? Generally you shouldn't need to move files around in Gatsby's generated output as it can result in unusual bugs. Possibly related is the discussion towards the end of this PR. I'd be interested to hear more about your use-case, particularly if there's something that Gatsby should be supporting? Or if the pathPrefix docs could be made clearer? Let's save other folks from having to go through this debugging process :) |
Agreed! Here's the use-case we're building for: we have some existing site directory pages that we thought would be a perfect candidate for building with Gatsby. We have a specific url structure we want to use: Things would be perfect if we could just drop all of the generated Gatsby files into an S3 bucket in a folder named To solve this, what we attempted to do was to (incorrectly) use the pathPrefix to point all of the js, css, and json generated by Gatsby at I hope at least some of that made sense! I've brought this issue up to my team and there are other solutions to get around this, like make a new page for tl;dr:We thought we could move the js/css assets generated by Gatsby into a special location to avoid Cloudfront behavior collisions that would cause 404s to existing pages. As things stand, it's difficult for us to introduce Gatsby into our existing (large) website since we don't really get to choose where a lot of these generated files get to live. Having the ability to choose how to organize the output of Gatsby would make it a lot easier for us (and probably others). In any case, an error would definitely be helpful-- not sure how difficult it would be to implement. Something along the lines of: "you moved files around when you shouldn't have, see the pathPrefix docs for more info." edit:I should also mention that the deploy strategy I described above is actually working fine in production right now using v1: https://www.payscale.com/research/US/Employer |
Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open! |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m Thanks again for being part of the Gatsby community! |
We are having the same behavior. We build Gatsby with --prefix-paths, and push to S3 bucket. The 404 page shows up for any page that does not exist, but if the Url does not have the prefix, the 404 briefly shows up and turns blank. So, |
Description
I'm running into a strange issue where my pages render as expected for a brief moment, but then the content is removed from the DOM within a few milliseconds. This only happens in our CI environment; locally I can test pages fine and they render without the flashing/flickering.
On debugging, it looks like the parent node of all of the gatsby content is being removed for some reason after the initial render:
gatsby build
runs as expected without errors.I've tried changing versions of various packages (gatsby, plugins, webpack) to see if it resolves, with no luck. Also tried commenting out several sections of React code and plugins to try to identify what might be causing this, without any luck.
Any idea what could cause gatsby to remove its content from the mount node?
Environment
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-5820K CPU @ 3.30GHz
Binaries:
Yarn: 1.7.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.3.0 - C:\Program Files\nodejs\npm.CMD
npmPackages:
gatsby: 2.0.0-beta.98 => 2.0.0-beta.98
gatsby-module-loader: 2.0.0-alpha.3 => 2.0.0-alpha.3
gatsby-plugin-google-tagmanager: 2.0.0-beta.3 => 2.0.0-beta.3
gatsby-plugin-react-helmet: 3.0.0-beta.4 => 3.0.0-beta.4
gatsby-plugin-sass: 2.0.0-beta.10 => 2.0.0-beta.10
gatsby-source-filesystem: 2.0.1-beta.10 => 2.0.1-beta.10
gatsby-transformer-json: 2.1.1-beta.5 => 2.1.1-beta.5
react: 16.4.2
react-dom: 16.4.2
webpack: 4.16.5
File contents (if changed)
gatsby-config.js:
package.json:
gatsby-node.js: N/A
gatsby-browser.js:
gatsby-ssr.js: N/A
The text was updated successfully, but these errors were encountered: