dzined
January 13, 2022, 12:09pm
1
Hi Y’all
I’m getting a bizarre issue with api calls.
I’m using React and Next Js, and using next js built in api routing
On my local machine when i submit a form (which in turn pushes data to the api/submitmyform which in turn calls a couple of external apis) it works fine, but i’ve deployed it to netlify and when i submit the form now i’m getting 502 when it tries to connect to each 3rd party url in my api call
Am i missing something basic?
Thanks
Matt
hillary
January 13, 2022, 10:08pm
2
Hey there, @dzined
Welcome to the Netlify Forums! Have you searched for relevant threads about 502s? You can do so using this link: Search results for '502 error' - Netlify Support Forums
Two things that may be particularly helpful starting with are:
Info:
site name: https://jordanjackson.netlify.app/
lambda func. name: sendNewsletterV2
Problem
Hi netlify community! I ran into a problem regards netlify functions. I uploaded a function with a request to mailchimp. The request works, and I can see on netlify, that function is successfully executed and sent to mailchimp with status code 200. Mailchimp also registers a new subscriber. The problem is that I am getting back 502 on my frontend (Nuxt.js). In my Nuxt.js code, my success promise i…
opened 12:25AM - 06 Jan 22 UTC
closed 08:20PM - 06 Jan 22 UTC
type: bug
status: awaiting user response
### Summary
I'm currently running Next 11.1.2, and tried updating this plugin f… rom v3.9.2 to v4.0.0. Some routes, I believe the ones with `getServerSideProps()`, now throw a 502 error.
Is v4 of this plugin supposed to work with Next 11, or should I update to Next 12? (I tried updating to Next 12 and the same routes fail, though with a standard 500 "Internal Server Error" page instead)
What set of versions should I use to try to reproduce this in another repo? Waiting for builds is pretty time-consuming so I'd love some suggestions for narrowing down the issue if you have any ideas.
For now I've downgraded back to v3.9.2 so I can continue to push new builds.
---
Here's the error I get with Next 11:
![Screen Shot 2022-01-05 at 4 24 40 PM](https://user-images.githubusercontent.com/1198882/148308730-de0e6d79-a48b-4437-92f2-cbbf96196873.png)
(👇 the error as json)
```json
{
"errorType":"Runtime.ImportModuleError",
"errorMessage":"Error: Cannot find module '/var/task/packages/studio721/.next/server/middleware-manifest.json'\nRequire stack:\n- /var/task/node_modules/next/dist/server/next-server.js\n- /var/task/.netlify/functions-internal/___netlify-handler/handlerUtils.js\n- /var/task/.netlify/functions-internal/___netlify-handler/___netlify-handler.js\n- /var/task/___netlify-handler.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"trace":[
"Runtime.ImportModuleError: Error: Cannot find module '/var/task/packages/studio721/.next/server/middleware-manifest.json'",
"Require stack:",
"- /var/task/node_modules/next/dist/server/next-server.js",
"- /var/task/.netlify/functions-internal/___netlify-handler/handlerUtils.js",
"- /var/task/.netlify/functions-internal/___netlify-handler/___netlify-handler.js",
"- /var/task/___netlify-handler.js",
"- /var/runtime/UserFunction.js",
"- /var/runtime/index.js",
" at _loadUserApp (/var/runtime/UserFunction.js:202:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:242:17)",
" at Object.<anonymous> (/var/runtime/index.js:43:30)",
" at Module._compile (internal/modules/cjs/loader.js:1085:14)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
" at Module.load (internal/modules/cjs/loader.js:950:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)",
" at internal/main/run_main_module.js:17:47"
]
}
```
And with Next 12:
![Screen Shot 2022-01-05 at 4 09 06 PM](https://user-images.githubusercontent.com/1198882/148307579-fa81d2a4-758c-4da5-8c71-890297702daf.png)
### Steps to reproduce
1. (I believe) Have a Next 11 project with pages using `getServerSideProps()`
2. Upgrade from plugin v3.9.2 to v4.0.0
3. Navigate to one of those routes
### A link to a reproduction repository
_No response_
### Plugin version
4.0.0
### More information about your build
- [ ] I am building using the CLI
- [ ] I am building using file-based configuration (`netlify.toml`)
### What OS are you using?
_No response_
### Your netlify.toml file
<details>
<summary>`netlify.toml`</summary>
```toml
# Paste content of your `netlify.toml` file here
```
</details>
### Your public/_redirects file
<details>
<summary>`_redirects`</summary>
```toml
# Paste content of your `_redirects` file here
```
</details>
### Your `next.config.js` file
<details>
<summary>`next.config.js`</summary>
```toml
# Paste content of your `next.config.js` file here. Check there is no private info in there.
```
</details>
### Builds logs (or link to your logs)
<details>
<summary>Build logs</summary>
```
# Paste logs here
```
</details>
### Function logs
<details>
<summary>Function logs</summary>
```
# Paste logs here
```
</details>
### .next JSON files
<details>
<summary>generated .next JSON files</summary>
```
# Paste file contents here. Please check there isn't any private info in them
# You can either build locally, or download the deploy from Netlify by clicking the arrow next to the deploy time.
```
</details>
If you’re still stuck after this, please let us know! It would also be beneficial to share a URL to your site, your most recent deploy log as the logs have lots of helpful information, and a link to your project repo if possible.