
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
- How to render .mov gif files from an App...
So I've read the support thread and the guides about file uploads. But I'm still having trouble rendering my .mov files to my React.js front end using the app...
- Sometimes the Reset Email Not Arriving
Sometimes when a user creates a recovery (Within the activity log of the user it indeed shows 'recovery.create') no email is delivered. I use SendGrid as smtp ...
- DATABASE ERROR
I suddenly cannot delete any documents in my organization collection. No matter I use SDK or delete it manually in appwrite console platform, it still cannot be...
