gatsby icon indicating copy to clipboard operation
gatsby copied to clipboard

Redirects and Headers stopped working on Netlify (and work again in gatsby 5.12.12 / adapter 1.0.4)

Open laurenskling opened this issue 8 months ago • 8 comments

Preliminary Checks

  • [X] This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
  • [X] This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions

Description

My sites weren't processing things like headers and redirects anymore since Dec 7th, between 3:13PM and 4:09PM (GMT+1)

I thought it was netlify/plugin-gatsby 3.8.0 but it's probably [email protected] or .12 or something that did it.

Nuking my yarn.lock and installing gatsby 5.12.12 (I was running 5.12.3), gatsby-adapter-netlify 1.0.4 (from 1.0.0) made redirects and headers work again.

Just wanted to throw it out there for others who might have their clients calling that redirects aren't working anymore 🥲

Reproduction Link

https://gatsby.dev/reproduction

Steps to Reproduce

  1. have gatsby 5.12.3
  2. build a site with redirects
  3. they dont work
  4. installed @latest
  5. it works. ...

Expected Result

Things not breaking

Actual Result

Things breaking

Environment

System:
    OS: macOS 13.6.1
    CPU: (8) arm64 Apple M2
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.2 - /var/folders/50/3fndm5d13gs_kr96nwxpxd9c0000gn/T/yarn--1702407952305-0.35108371319464915/node
    Yarn: 1.22.19 - /var/folders/50/3fndm5d13gs_kr96nwxpxd9c0000gn/T/yarn--1702407952305-0.35108371319464915/yarn
    npm: 9.8.1 - /usr/local/bin/npm
  Languages:
    Python: 3.10.9 - /usr/local/bin/python
  Browsers:
    Chrome: 120.0.6099.71
    Safari: 17.1

Config Flags

No response

laurenskling avatar Dec 12 '23 19:12 laurenskling

This is probably related to https://github.com/gatsbyjs/gatsby/pull/38745 which was released in timeframe you reported.

Did the builds with not working redirects perhaps had warning line like that?

gatsby-adapter-netlify@X is not compatible with your current Gatsby version

Looking at the code I do see that it would then skip trying to use adapter completely if manually managed adapter version is deemed incompatible with used gatsby version and that would make it so nothing tries to handle redirects.

I do think it probably should discard used version when deemed in compatible and try to install compatible one to avoid this or maybe just fail the build with informative message to avoid those broken deploys - but before doing any improvements there, it would be good to confirm my assumption about how that happened and wether warning did happen in build logs

pieh avatar Dec 14 '23 09:12 pieh

Yes I now see it as well:

4:11:32 PM: warning [email protected] is not compatible with your current Gatsby version 5.12.3 - Install [email protected] or later.

I did not spot this earlier, there's a lot in my logs ;)

Yeah, I would really wished this was a crash, not a warning. Now my builds were inacurate for 7 days, because I have some business logic that rely on the redirects.

laurenskling avatar Dec 14 '23 09:12 laurenskling

I will make it crash, but of course this would only applicable to new gatsby versions and can't really make already released versions handle it properly.

After few thoughts - discarding user managed adapter version and installing "compatible" one is not good, because it would lose any adapter options that user specified, so failing the build is the best solution here

pieh avatar Dec 14 '23 09:12 pieh

Yeah in my opinion crashing (with a good message) and letting me fix it is always best. It's build time.

You cannot allow 1.0.0-1.0.3 in that manifest file? That would fix it as well right?

laurenskling avatar Dec 14 '23 09:12 laurenskling

You cannot allow 1.0.0-1.0.3 in that manifest file? That would fix it as well right?

I can and will update it to allow those versions (was doing some testing and >=1.0.0 <=1.0.3 is valid version selector not only for verifying version range, but also as argument for npm install gatsby-adapter-netlify@">=1.0.0 <=1.0.3" which would be used for "zero-conf" scenarios)

But that will be part of changes to break the build for incompatible versions by default to prevent potentially broken deploys like ones you reported (there will be escape hatch to continue the build with things as-is but this is something that user will have to opt into meaning they acknowledge gatsby doesn't want to allow that and basically user become responsible for potential problems caused by "incompatibility")

pieh avatar Dec 15 '23 08:12 pieh

Actually - I will split things - I wasn't sure initially if installation will continue to work with code as-is (just knew it could work overall, but possibly changes were needed). As I looked into adjusting the behavior it was clear I will need to spend quite a bit of time on testing new behavior in bunch of scenarios - so at least for now I could do quick relaxation of compatible version to help with the issue faster and improve the logic as next step.

So https://github.com/gatsbyjs/gatsby/pull/38758 will update just the manifest

pieh avatar Dec 15 '23 09:12 pieh

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

github-actions[bot] avatar Jan 04 '24 12:01 github-actions[bot]

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

github-actions[bot] avatar Jan 28 '24 12:01 github-actions[bot]

Hey again!

It’s been 60 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 HUMAN_EMOTION_SORRY. Please feel free to comment on this issue or create a new one if you need anything else. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

github-actions[bot] avatar Mar 08 '24 12:03 github-actions[bot]