24,569 questions
0
votes
2
answers
25
views
How to properly type Axios with response interceptor + useSWR Fetcher in TypeScript?
I'm building a Next.js app with useSWR, axios, and TypeScript.
I have an Axios instance with a response interceptor that returns response.data:
// api.ts
import axios from "axios";
export ...
0
votes
1
answer
53
views
How to use abort signal directly in axios api request?
I want to cancel API request when leave page using abort signal in my axios request, i can pass signal via method param but i have to re-write/pass signal everywhere, this is not effective if i have ...
-4
votes
0
answers
42
views
ExpressJS API integration [closed]
I've been trying to build an API integrated section for my website since it needs a news section. I have a small amount currently built but am struggling with getting it to work. This is through using ...
-3
votes
0
answers
64
views
Express route /api/test returns 404 Not Found even though it’s defined
I have a simple Express server listening on port 5002. In my server.js I’ve defined a test endpoint:
// server.js
import express from 'express';
import cors from 'cors';
const app = express();
app....
-1
votes
0
answers
42
views
My Axios code successfully calls API endpoints but data doesn't work with Vue components
Link to my Python backend code.
Link to my separate Axios code (which works).
Link to my Vue project with the Axios code built in (which doesn't).
I posted some API questions here a few days ago. ...
0
votes
0
answers
63
views
How to control the order of promise's callback [duplicate]
I have promises like this,
var results_arr = [];
var promises = [];
for (var i = 0 ; i < items.length;i++){
var url = `/api/stat/${items[i].id}`;
promises.push(
...
-1
votes
1
answer
29
views
Conditional type for Axios return based on function arguments
The function axiosGet:
export const axiosGet = async <TData>({
url,
params = {},
onDone,
onError
}: TypeAxiosArgs<TData>) => {
try {
const r = await ...
0
votes
0
answers
19
views
React Tanstack Query useInfiniteQuery network issue
I have a React app with a profile outlet route, where the index is the 'products'. I also have a similar route called 'savedProducts'. The difference is that the 'products' page lists by outletparam (...
0
votes
1
answer
39
views
How to pass variables other than the Promises between multiple .then() chains?
After looking up answers about how to download files with Axios in React I implemented the following code:
const [fileName, setFileName] = useState("")
const [extension, setExtension] = ...
0
votes
0
answers
56
views
How to download a document from Express-Node.js backend through a HTML hyperlink (<a>) on the frontend?
I know I can download static files from frontend with
<a href="/path/fileName" download>MyDocument</a>
, but I need to download dynamic files that can be uploaded and deleted by ...
0
votes
0
answers
28
views
In a React project, after updating MSW, tests return an empty string
The configuration settings are as follows
vitest.config.js
/// <reference types="vitest" />
import { defineConfig } from "vitest/config";
import react from "@vitejs/...
1
vote
0
answers
30
views
Why aren't my variables passed to my Tanstack mutation function
I'm trying to start using Tanstack and am having problems passing variables into mutation functions.
In the following, "newTodo" is returning undefined.
<script setup>
import axios ...
0
votes
0
answers
30
views
How to modify/complete url on execute in useAxios from vueuse? Or: How to delete item using useAxios?
I'm building a Vue application which makes requests to an REST-API.
I want to use "useAxios" from vueuse to make theese requests like below:
const {data: todosList, isLoading, error, execute}...
-1
votes
0
answers
31
views
ExpressJS Res.Download() Not Sending File to Download
I am trying to download the file from expressjs backend using Axios. The file is of size 1kB but on attempting to download it every time, I am getting 17 bytes file that does not open.
Here is my ...
-1
votes
0
answers
26
views
CORS error - cross-origin resource sharing error wildcard origin not allowed in different browsers when i use my local server [duplicate]
I am writing and testing a full-stack application. My frontend is uploaded to hosting and has the address for example - planner. And my server is on a local computer with a database. For the test, I ...
0
votes
1
answer
105
views
CORS Issue When Using External Service for API Calls in Next.js"
I am encountering an issue with Next.js that I don't quite understand. I have a service file that I want to use to make API calls faster and more structured. However, when I call the API via this ...
0
votes
0
answers
32
views
Electron Vite dist build not referencing dynamically imported form-data package required by Axios for dist build
Im building an Electron App with Vite that uses Axios. It seems that Axios requires a dynamically imported package called form-data. When running my built .exe portable after Ive built it I get the ...
0
votes
0
answers
9
views
how to test axios interceptor in react
I have below implementation of axios interceptor to handle 401 error:
export const compareApiClient: AxiosInstance = axios.create();
if (compareApiClient.interceptors) {
compareApiClient.interceptors....
0
votes
0
answers
61
views
Facing Random Timeout Errors on POST Requests to /messages Graph API (WhatsApp Business) in AWS EC2 Environment
I'm encountering unexpected timeout issues when making POST requests to the /messages endpoint of the Graph API (WhatsApp Business). The issue seems to happen only on my deployed system (running on an ...
0
votes
0
answers
81
views
vue axios.post method is neither doing anything nor throwing an error
I have a vue frontend with a flask backend and in addition a c++ camera backend. All of this has been working before. Now I switched to another computer and I´m using a different camera backend and ...
0
votes
0
answers
25
views
In React, how can I save remote data to the Downloads folder?
I wish to provide a button or link that, when pressed, streams data from a remote server (via axios), and saves the data to a file in the Downloads directory.
Is this possible?
0
votes
0
answers
46
views
How to read from .Net Core FileStream in Javascript/Axios?
Endpoint:
[HttpGet("GetFileStream/{id}")]
[Produces("application/octet-stream")]
public async Task<Stream> GetFile(int id)
{
Stream stream = await Services.FileStorage....
0
votes
0
answers
46
views
Laravel 11 Sanctum Authentication Issues: 401 Unauthorized on /api/user and /api/logout (React Frontend)
I'm working on a Laravel 11 backend with a React frontend using Laravel Sanctum for authentication.
Login and Logout work, but after logging in, I still get 401 Unauthorized when fetching the ...
1
vote
1
answer
30
views
axios interceptor rejected promise doesn't trigger useMutation() isError parameter to turn to true
I am trying to use an axios interceptor return response.data or a rejected promise on error on every call to api.
I have confirmed the backend recieves the data and I can create a new user if all the ...
0
votes
1
answer
76
views
CRA Migration to Vite + React + TS Issues
I've been working on migrating a codebase from CRA to Vite. I have all of the code issues resolved but I'm running into issues with a number of the packages that I'm importing. I'm assuming it's all ...
0
votes
2
answers
143
views
JWT Token/Cookies Not Sent from Frontend (Vercel) to Backend (Render) – Getting 401 Unauthorized
I'm a self-learning web developer, and I recently deployed my backend on Render (free tier) and my frontend on Vercel. The stack includes Node.js, Express, MongoDB, WebSockets, and authentication is ...
0
votes
0
answers
41
views
How to modify Kubernetes ingress for sending cookie?
I have a web application running on kubernetes cluster. There are some cookies on the frontend part and I want to add this cookies in the request header. I'm using axios for sending request. I added ...
0
votes
0
answers
19
views
Session changing upon accessing different route using express-session and socket.io-client
I'm continuing to struggle with how to create a fake client that mimics a browser accessing routes on a Node.js server. Things work perfectly with an actual browser, but (for testing purposes) I would ...
2
votes
0
answers
42
views
Client side request for monero-wallet-rpc with credentials
I wonder how to create a axios request from client side for monero-wallet-rpc with --rpc-login credentials because all of my tries are failing with response status code 401. Below is my sample command ...
0
votes
0
answers
11
views
Vite React Django5 allauth jwt google login
My google login code seems to be working but does redirect back to the home page. the access and refresh token are in the browser application but it still wont redirect back to the home page, it keeps ...
0
votes
0
answers
32
views
How to permanently override nested/transitive dependencies in npm for security fixes (Axios in @nuxtjs/axios)
I'm working on a Nuxt 2 project where I need to fix a security vulnerability in Axios v0.21.4, which is a nested dependency of @nuxtjs/axios.
I've added the following to my package.json:
"...
0
votes
0
answers
37
views
Spring Boot Todo App: POST request not working with React & Axios
I created a small Todo project using Spring Boot for the backend and React for the frontend. However, when I try to send a POST request from React using Axios, I encounter an error.
I want to make ...
0
votes
1
answer
29
views
Axios + cookieParser still returns cookie undefined
I am building a React + Node.js project. I have a FE calling the BE endpoint with axios. In the request I have the following:
await axios.post('http://localhost:8080/submit-survey', formDataToSend, {
...
0
votes
1
answer
29
views
Nifi API gives 400 invalid request from NodeJs Axios (works fine through curl or postman)
I have Apache nifi running locally.
I am able to access api url as below (generated from postman).
curl --location --insecure ^
"https://localhost:8443/nifi-api/access/token" ^
--header &...
0
votes
0
answers
215
views
Meta WhatsApp Cloud API: "(#100) Invalid parameter" error while sending template message in Node.js
I'm trying to integrate the Meta WhatsApp Cloud API in my Node.js + Express project to send a registration confirmation message after a user signs up. However, I am encountering an error:
(#100) ...
0
votes
0
answers
43
views
React Query Stuck in Loading State on 406 Not Acceptable Response with Axios
I'm using React Query (@tanstack/react-query) to fetch RDF data from an API with Axios, but when the API returns a 406 Not Acceptable response, the query remains in a loading state indefinitely ...
2
votes
1
answer
84
views
Page hot-update by Vite when send axios request and using @tailwindcss/vite plugin
I have a project that uses Axios for data fetching. However, I noticed something strange:
When I fetch data by clicking a button and my vite.config.js file contains tailwind() (@tailwindcss/vite ...
1
vote
1
answer
45
views
When sending axios requests, the component is rendered too many times (or not)
I use the following code:
The useBaseAxios hook (the basic hook for queries, will be used inside another custom hook)
import { useState, useEffect} from 'react';
import axios from 'axios';
const ...
0
votes
1
answer
106
views
How to redirect to a URL from the Location header in a 302 response using Axios?
the request returns a 302 with a URL in the Location header. The browser automatically makes a GET request to that URL, but I need to redirect the user to the page with that URL.
const res = axios.get(...
0
votes
1
answer
54
views
Behavior of axios interceptors
I have an app that uses axios interceptors to update the refresh token and access token. Everything works normally, but I have a question about the behavior of the axios interceptors.
I have the ...
1
vote
0
answers
20
views
Axios put request - 422 error unprocessable entity
Front end:
await axios.put('/api/updategardensize', { gardenSize :'haha'} ,{withCredentials: true})
Backend API ENDPOINT IS:
@app.put("/api/updategardensize", status_code=status.HTTP_200_OK)...
2
votes
1
answer
45
views
AbortController stop axios request and block the next request
There is a button in my component that I use to get a random quote from the API, and it is also possible to stop a query by clicking on another button.
The problem is that when I cancel the first ...
0
votes
0
answers
29
views
Cannot create a reservation of a workspace, getting the error code 8201 when using Zoom API
I'm developing a website that connects to the Zoom API using a server-to-server oAuth connection. After successfully obtaining an access token, I send a POST request to create a reservation for a ...
1
vote
1
answer
60
views
How to set DNS server for a single axios get request?
I know I can set the DNS servers in node
dns.setServers([
'4.4.4.4',
'[2001:4860:4860::8888]',
]);
But this is set globally and I'm developing a module (dependency) and I don't want to affect ...
0
votes
0
answers
33
views
Access protected resource(Spring Boot) with the help of React (Axios) works fine with postman, getting CORS Error
Workflow is :
User login to the system using username and password
Successful login gives back token, which we use to access restricted resource
We are sending header from Client side to server ...
0
votes
0
answers
21
views
Axios/axios.get for Twilio not responding
I am trying to forward a text message to an email address. This should be simple, but the code on Twilio's docs produces a syntax error. I modified the code and I am working through it, but I am ...
0
votes
0
answers
29
views
Connecting Expo to Firebase Functions backend through Axios
I'm having problems with my frontend, which is a React Native project using Expo for visuals. I'm using the Expo Go mobile app for the connection. My backend runs locally using Firebase Functions.
I'...
0
votes
0
answers
68
views
Validation of sending sms through sms gateway - Yeastar
I'm trying to read the message about the correct or incorrect sending of an sms message by the Yeastar TG200 gateway. In the browser I get this message in html form:
<html><head><meta ...
0
votes
1
answer
84
views
Expo Android app keeps getting rejected from Google Play due to login credential issues, even though I provided the correct ones
Expo Android app keeps getting rejected from Google Play due to login credential issues, even though I provided the correct email and password for them to log in. I use Axios POST to handle login ...
0
votes
0
answers
37
views
unexpected end of archive error when trying to open a Zip file downloaded via javascript
I'm trying to download a ZIP file from a backend API that returns the ZIP binary as a string.
If I do this:
curl --location 'https://backend-endpoint.com/get-file' >> test.zip it creates a ZIP ...