
I have this code to make a get request to an API
TypeScript
function fetchUserListPerPage(page) {
return new Promise(async (resolve, reject) => {
try {
const response = await axios
.get(`${process.env.CHARA_API_URL}/api/v1/bestvalue/b2b/customer/list?_ipp=100&_p=${page}`, {
headers: {
Authorization: `${process.env.CHARA_API_KEY}`
}
});
resolve(response.data);
} catch(error) {
console.log(error);
reject({ Content: { Records: [] } });
}
});
}
And sometimes the request fails with the getaddrinfo EAI_AGAIN error
TL;DR
Code is making a GET request using axios to an API, sometimes resulting in a getaddrinfo EAI_AGAIN error. This error typically occurs due to DNS lookup failure. Adding a timeout option in axios to handle this error might help:
```javascript
function fetchUserListPerPage(page) {
return new Promise(async (resolve, reject) => {
try {
const response = await axios
.get(`${process.env.CHARA_API_URL}/api/v1/bestvalue/b2b/customer/list?_ipp=100&_p=${page}`, {
headers: {
Authorization: `${process.env.CHARA_API_KEY Recommended threads
- A full logout for users logged in via Go...
I have a web app in reactjs that uses the Google login that is integrated into Appwrite for user login. I use `createOAuth2Token()` to login to their account. ...
- Relationship problem
When I UPDATE a document that has a relationship and I pass id and all the data of the relationship it works but if i CREATE a document then it says 401 user un...
- Automatic chunking for large media does ...
Hi! Using https://github.com/appwrite/sdk-for-apple to upload images to Storage, it does not upload images larger than ~2mb. Error message: `Invalid document...
