Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Error decoding lambda response #17

Closed
wei opened this issue Jun 10, 2020 · 7 comments
Closed

Error decoding lambda response #17

wei opened this issue Jun 10, 2020 · 7 comments

Comments

@wei
Copy link

wei commented Jun 10, 2020

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

Related: https://community.netlify.com/t/error-decoding-lambda-response/16348

This issue started happening a couple days ago when netlify made an unannounced breaking change as seen in the ticket above.

The same repo I used in #9 is now broken without any changes.

Repo:
https://github.com/wei/next-on-netlify-demo-wei

Example:
https://relaxed-mirzakhani-568b34.netlify.app/api/debug/12345
https://relaxed-mirzakhani-568b34.netlify.app/api/debug/12345?testqs=1

I wonder if this is something that should be done in next-on-netlify library or on my side. Any help is appreciated! 🙇

@FinnWoelm
Copy link
Contributor

FinnWoelm commented Jun 10, 2020

Hey @wei,

Great to see you again!

You are absolutely right. It has to do with Netlify's newly added support for multiValueHeaders. If you are interested in the in-depth explanation, have a look at this issue: netlify/next-on-netlify-demo#3

The short answer to solving this is: update to next-on-netlify v2 :)
Here are the instructions for migrating from v1 to v2: #9 (comment)

Does that help? 🙂

@wei
Copy link
Author

wei commented Jun 10, 2020

Thanks! Glad to hear it's fixed in v2. I was in the progress of upgrading but had some issues and ran into the multivariable issue with the existing site : )

I will take a deeper look and open a new issue if I can reproduce it with a sample repo.

🚀 Next on Netlify 🚀
   Functions directory: out_publish/
   Publish directory:   out_functions/
   Make sure these are set in your netlify.toml file.
🌍️ Copying public/ folder to out_publish/
💼 Copying static NextJS assets to out_publish/
<Project Root>/node_modules/fs-extra/lib/copy-sync/copy-sync.js:62
    throw new Error(`'${dest}' already exists`)
    ^

Error: 'out_publish/_next/static/chunks/0.js' already exists
    at mayCopyFile (<Project Root>/node_modules/fs-extra/lib/copy-sync/copy-sync.js:62:11)
    at onFile (<Project Root>/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:10)
    at getStats (<Project Root>/node_modules/fs-extra/lib/copy-sync/copy-sync.js:48:44)
    at startCopy (<Project Root>/node_modules/fs-extra/lib/copy-sync/copy-sync.js:38:10)
    at copyDirItem (<Project Root>/node_modules/fs-extra/lib/copy-sync/copy-sync.js:122:10)
    at <Project Root>/node_modules/fs-extra/lib/copy-sync/copy-sync.js:115:39
    at Array.forEach (<anonymous>)
    at copyDir (<Project Root>/node_modules/fs-extra/lib/copy-sync/copy-sync.js:115:23)
    at onDir (<Project Root>/node_modules/fs-extra/lib/copy-sync/copy-sync.js:105:10)
    at getStats (<Project Root>/node_modules/fs-extra/lib/copy-sync/copy-sync.js:45:37)

Cheers!

@wei wei closed this as completed Jun 10, 2020
@wei
Copy link
Author

wei commented Jun 10, 2020

It looks like the issue was caused by an old _next folder in /public. It is now working perfectly after I pruned all files. Sorry for the troubles and thanks for the great work!

@FinnWoelm
Copy link
Contributor

Great that it's working now!! 🙌 And good job on figuring out that it was the old _next folder in /public — did not think of that!

Keep me posted on any trouble you encounter! And let me know if you build something awesome that I can feature in the README 😁

Happy hacking!! 🔥

@khawarjatoi
Copy link

khawarjatoi commented Dec 18, 2020

hey guys, There is no _next folder in any directory but I'm still getting same error when I try to deploy.

throw new Error(`'${dest}' already exists`)
    ^

Error: 'out_functions/next_index/next_index.js' already exists

@adaam2
Copy link

adaam2 commented Dec 23, 2020

@khawarjatoi I was on next v9, and upgrading to 10.0.4 fixed that issue for me :)

@khawarjatoi
Copy link

khawarjatoi commented Dec 23, 2020

@adaam2 thanks man. I was also using v9. Upgrading to the same version fixed the issue.
Screenshot from 2020-12-24 01-51-56

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

No branches or pull requests

4 participants