We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
when using axios to get external url in my router, netlify crashes and throws error
use this router in server less express app:
router.post('/test-server', async (req, res) => { try { const response = await axios({ url: 'https://example.com/' }); console.log('Response status:', response.status); res.json({ status: response.status, data: response.data }); } catch (error) { if (axios.isAxiosError) { console.log('Error from API', error); res.status(error.response.status).json({ error: error.response.statusText }); } else { console.log('Internal error', error); res.status(500).json({ error: 'Something went wrong' }); } } });
run netlify serve --debug
netlify serve --debug
after server started run:
curl -X POST http://localhost:8888/.netlify/functions/server/test-server
observed this error with axios, the server is working fine with node, but with netlify it giving this error.
[build] command = "npm install && npm run build" functions = "functions"
[functions] included_files = ["./express/.json", "./.json"]
[[redirects]] from = "/server/*" to = "/.netlify/functions/server/:splat" status = 200
System: OS: macOS 14.3.1 CPU: (8) x64 Apple M1 Memory: 17.27 MB / 8.00 GB Shell: 5.9 - /usr/local/bin/zsh Binaries: Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node Yarn: 1.22.21 - /usr/local/bin/yarn npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm Watchman: 2024.01.22.00 - /usr/local/bin/watchman npmGlobalPackages: netlify-cli: 17.20.1
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
when using axios to get external url in my router, netlify crashes and throws error
Steps to reproduce
use this router in server less express app:
run
netlify serve --debug
after server started run:
curl -X POST http://localhost:8888/.netlify/functions/server/test-server
observed this error with axios, the server is working fine with node, but with netlify it giving this error.
Configuration
[build]
command = "npm install && npm run build"
functions = "functions"
[functions]
included_files = ["./express/.json", "./.json"]
[[redirects]]
from = "/server/*"
to = "/.netlify/functions/server/:splat"
status = 200
Environment
System:
OS: macOS 14.3.1
CPU: (8) x64 Apple M1
Memory: 17.27 MB / 8.00 GB
Shell: 5.9 - /usr/local/bin/zsh
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.22.21 - /usr/local/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
Watchman: 2024.01.22.00 - /usr/local/bin/watchman
npmGlobalPackages:
netlify-cli: 17.20.1
The text was updated successfully, but these errors were encountered: