Skip to content

next-on.netlify.com redirects with error to next-on.netlify.app #3

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

Closed
cassidoo opened this issue Jun 6, 2020 · 3 comments
Closed

Comments

@cassidoo
Copy link
Contributor

cassidoo commented Jun 6, 2020

When you go to https://next-on.netlify.com/, it redirects to https://next-on.netlify.app/ and shows the error:

error decoding lambda response: error decoding lambda response: json: cannot unmarshal number into Go struct field APIGatewayProxyResponse.multiValueHeaders of type string

I have a feeling this has to do with this announcement from the team about domains being moved to .app.

@FinnWoelm
Copy link
Contributor

Hey @cassidoo,

Thank you for catching this error!

The reason for the demo site breaking is actually really exciting! It's a combination of a few things:

  1. The demo site used next-on-netlify v1.2 until this morning. I was planning to update it to v2 soon, but I wanted to demo a few of the new features (getStaticProps and getServerSideProps). So when the site crashed, it was with next-on-netlify v1.2. There are two differences between next-on-netlify v1.2 and v2 that are relevant for this issue:

    1. next-on-netlify v1.2 returned response headers from Netlify Functions as multiValueHeaders. They're like normal headers, but let you set multiple values for the same header.
    2. next-on-netlify v1.2 set the content-length header as an integer (rather than a string).
  2. During development of v2, I found out that Netlify Functions actually do not support multiValueHeaders. They just get quietly ignored. I wrote about that in next-on-netlify issue #9 and filed issue #923 on netlify-cli. At the same time, I implemented a workaround in next-on-netlify to convert the multiValueHeaders into plain headers, so that next-on-netlify v2 would have support for response headers.

  3. As I converted those multiValueHeaders to plain headers, I also found out that Netlify Functions do not support having an integer in a header. See issue #451 on netlify-cli. Because the content-length header defaults to an integer, I also implemented a workaround to coerce all headers into String for next-on-netlify v2.

  4. Now the exciting news: From what I can tell, Netlify actually implemented support for multiValueHeaders in Netlify Functions on Thursday or Friday 🤯 🙌 Because the demo site was running next-on-netlify v1.2 which uses multiValueHeaders and returns content-length as an integer and because Netlify Functions no longer ignore multiValueHeaders now, but still crash when there's an integer in one of the headers, it caused the demo site to crash.

I just updated the demo to use next-on-netlify to v2 which uses plain headers and coerces all headers to string. Everything works again now 🙂

The support for multiValueHeaders is super exciting! Do you have access to the issue I filed with netlify-cli? It was moved to an internal repo and I can no longer access it. But I would love to know if it's true that Netlify Functions now support multiValueHeaders and if this feature is stable!

If multiValueHeaders really are supported now, I can remove the workaround from next-on-netlify and, more importantly, I can add support for preview mode!

Thanks again for flagging this error - much appreciated! 🏴
- Finn

@cassidoo
Copy link
Contributor Author

cassidoo commented Jun 9, 2020

image

Heck yeah, looks like your feature request was the merged one! :)
This is awesome. You're a really valuable member of the Netlify community, I'm going to share this internally.

@FinnWoelm
Copy link
Contributor

Hey @cassidoo, thank you for looking into! That's really great to hear. Netlify rocks 😁

PS: Closing this for now 🙂

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