axios
axios copied to clipboard
Always request failed with status code 503 in node environment
Describe the bug
It's a very strange bug, I can't use axios in node environment on my deepin system, but it works fine in windows and mac.
{"message":"Request failed with status code 503","name":"Error","stack":"Error: Request failed with status code 503\n at createError (/home/hexi/Learn/nodejs-axios/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/home/hexi/Learn/nodejs-axios/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/home/hexi/Learn/nodejs-axios/node_modules/axios/lib/adapters/http.js:270:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1359:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)","config":{"url":"https://alpha-testnet.api.matrixmarket.xyz/mart/v2/api-docs","headers":{"Accept":"application/json, text/plain, /","User-Agent":"Mozilla","Content-Type":"application/json","host":"alpha-testnet.api.matrixmarket.xyz"},"transformRequest":[null],"transformResponse":[null],"timeout":0,"withCredentials":true,"responseType":"text","xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"method":"get"}}
To Reproduce
This is a minimal reproduction repository
https://github.com/Hexi1997/nodejs-axios
Code snippet
const axios = require('axios').default
axios({url:'https://alpha-testnet.api.matrixmarket.xyz/mart/v2/api-docs',responseType:'text',withCredentials:true,headers:{ "User-Agent": "Mozilla","Content-Type": "application/json"}}).then(v=>{console.log(v)}).catch((e)=>console.log(JSON.stringify(e)));
Expected behavior
fetch data succeed!
Axios Version
0.21.2
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
18.12.0
OS
deepin community 20.2.2
Additional Library Versions
No response
Additional context/Screenshots
No response
I had this same issue and it was caused by me changing my npm config proxy for npm install. I resolved it by resetting the proxy after npm install.
I had this same issue and it was caused by me changing my npm config proxy for npm install. I resolved it by resetting the proxy after npm install.
I have tried as you say, still no
I had the same issue, AxiosError: Request failed with status code 503 My npm command is trying to reach distant server.
I have same issue
Get 503 with axios behind a proxy server, while node-fetch works fine. F* axios
I finally solved the issue, it was for sure a proxy issue.
- npm config set noproxy ".<your_domain>.net"
- npm config get proxy
- npm config set proxy ""
- export http_proxy=""
- export https_proxy=""
- export HTTP_PROXY=""
- export HTTPS_PROXY=""
- export no_proxy=""
You can try setting this configuration first. I hope it will help you.
I have same issue
I have same issue, I need an agent。