Docs-website: Gatsby CreatePages error: Non-deterministic routing danger

Created on 17 Mar 2021  路  3Comments  路  Source: newrelic/docs-website

After make a change and saving, on hot reload we see this error which runs for like 5 mins through every page it seems. It makes me think it has something to do with our / change to our routes. I've done some research on it, and haven't found anything definitive as to what the problem may be. But we've tried to do all the standard troubleshooting techniques, and it still persists

warn Non-deterministic routing danger: Attempting to create page:
"/jp/docs/using-new-relic/welcome-new-relic/get-started/glossary", but page
"/jp/docs/using-new-relic/welcome-new-relic/get-started/glossary/" already exists

This error will spit out in the terminal for about 5 mins

We reached out to Dustin at Gatsby and he pointed to this code

and said

There鈥檚 no guarantee that that鈥檚 deterministic and may differ. I bet if you log before that line that鈥檚 the code path that is triggered and is causing the difference.

Steps to repro

  • after running yarn start and viewing the site locally
  • make a change locally and save, watch your terminal
  • go make a coffee, come back.

Expected

  • This error is resolved so it doesn't appear when reloading a local change to the site.
P3 bug gatsbysites hero 3

Most helpful comment

Hi folks :) I solve this by console logging, e.g. something like:

console.log('\n==================================='n)
console.log(JSON.stringify(page, null, 2))

and I _predict_ (but I've been wrong before!) you'll see a different page path in the highlighted context. You likely just need to normalize in the same way when you create the page in the first place, albeit that is a touch strange.

In any scenario -- the warning is not a red herring, definitely on content update, the page is being re-created with a different (non-trailing) path, so that's the most likely spot!

All 3 comments

Hi folks :) I solve this by console logging, e.g. something like:

console.log('\n==================================='n)
console.log(JSON.stringify(page, null, 2))

and I _predict_ (but I've been wrong before!) you'll see a different page path in the highlighted context. You likely just need to normalize in the same way when you create the page in the first place, albeit that is a touch strange.

In any scenario -- the warning is not a red herring, definitely on content update, the page is being re-created with a different (non-trailing) path, so that's the most likely spot!

@DSchau thanks for the pro tip here. We appreciate it!

@jerelmiller if you get bored again.... 馃グ

Was this page helpful?
0 / 5 - 0 ratings