Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
0 answers
20 views

How to Render an Error Component Based on API Call Failure in React?

my console my folder structure I'm working on a React application where I need to fetch news articles from an API. I want to display an error component if the API call fails. Currently, I'm using ...
user27073439's user avatar
0 votes
0 answers
22 views

Request fails when sending from fetch but succeeds in api client

I am sending the following fetch request: try { const response = await fetch(`http://localhost:3000/fs`, { headers: { Accept: "*/*", method: "readFile&...
Ethan's user avatar
  • 1,316
-2 votes
0 answers
13 views

hellow there i am facing problem with fetch data from json file in jquery and ajx [duplicate]

this my ajax and jquery code i expecting to generae and table get all data from json file by jquery and ajax and it keep give me this issue in consle Access to XMLHttpRequest at 'file:///C:/xampp/...
hatim's user avatar
  • 1
-1 votes
0 answers
31 views

Javascript fetch request returning empty [closed]

I am currently working on the CS50W Network project, and implementing the loading of all posts via API (path is created). When accessing the JsonResponse data directly through the path in the search ...
mustafa hameed's user avatar
0 votes
0 answers
14 views

Calling MVC endpoint with Ajax when WS-Fed cookie has expired

I have an ASP.NET MVC web application targeting .NET 8. We use WS-Federation for user authentication. For the purposes of this question, let's say that every endpoint is decorated with an ...
Philip Stratford's user avatar
0 votes
0 answers
43 views

Nextjs "Fetch failed" even if server is returning 200 [closed]

I am developing an app in NextJs 14.2.5. I am encountering an issue when I make a POST using fetch; the server returns the correct response with a 200 status. I have tested this on Postman as well and ...
One Mypt's user avatar
0 votes
0 answers
31 views

CORS error in Mongo DB Atlas Data API call via Client side JS [duplicate]

I am trying to make an API call via Client side JS to Mongo DB Atlas API. Code snippet is as below. try { const exportData = await exportBackupData(); const url = `...
amitz27's user avatar
  • 69
1 vote
1 answer
62 views

Fetch request does not work with expressJS server (but both are working fine)?

I have a fetch request in a server component in a NextJS app. It looks like that (I tried to reduce all code to minimum working example) : export async function bookRoom(params: BookingRequest) { ...
user27054072's user avatar
-2 votes
0 answers
22 views

Facing errors when api calls made to update old data & incomplete info logging to debug [closed]

const fetchData = async (): Promise<void> => { let U; // URL const RSA = performance.now(); // Request Sent At let RRE; // Response Received try { const P = []; //...
Ekaansh Parashar's user avatar
1 vote
2 answers
47 views

How to parse data received from TanStack Query (React Query) to keep it in cache?

I am learning TanStack Query (previously React Query) and so far I menaged to successfully fetch data. I am wondering how to mutate it so that I can take the advantage of all TanStack Query features - ...
jazzgot's user avatar
  • 380
0 votes
0 answers
39 views

API is working at development, but in production fails

I am trying to run my site in nextjs (typescript) with my API. When I run it in development, the API works, but when I run on production (vercel), it throws a timeout. In the API call, I pass one ...
Matan15's user avatar
-4 votes
0 answers
28 views

I'm experiencing an issue with fetching data using the JavaScript fetch API [duplicate]

I'm experiencing an issue with fetching data using the JavaScript fetch API, but only in the production environment. The same code works perfectly in my local development setup. When trying to fetch ...
Syed Tasavour's user avatar
0 votes
1 answer
22 views

Function defined in an `api.js` file stored in the public folder, but when that function is called within component, error claims it is not defined

I'm trying to call a fetchAPI function that is defined in my api.js file, but am continually receiving the error that it is undefined. Below is the code within the api.js file (note: the api code was ...
Laura Gorski's user avatar
0 votes
2 answers
51 views

why is my code fetching the same items twice when the page is loaded?

I am learning React and trying to fetch some data for a product list. It is supposed to fetch only 2 items at first and fetch 2 more items when pressing the button, but it is now fetching the same ...
haru's user avatar
  • 31
-2 votes
1 answer
62 views

Fetching Is done perfectly in localhost but not in deployed app [closed]

Issue with Fetching Data in Deployed Vercel App but Works on Localhost I'm facing an issue with fetching data in my React application. Here's a simplified version of the code I'm using: useEffect(() =&...
ashikpy's user avatar
1 vote
1 answer
36 views

How to convert multiple Files (as File[]) into a single Blob? [duplicate]

In Postman, it is possible to initiate a POST request with a body of form-data and the below key-value pairs: However, when I tried putting multiple files, as File[] into a single Blob (as the below ...
hokwanhung's user avatar
-3 votes
2 answers
48 views

I'm trying to extract data from this API using Node.js

I'm trying to extract data from this API and this is what the structure looks like: { "wait_time": { "port": [ { "port_id": "240201", ...
Perla De la O's user avatar
1 vote
0 answers
38 views

Failure to mock global.fetch() function

// evaluator.ts export class Evaluator { private functionRegistry: FunctionRegistry; constructor(functionRegistry: FunctionRegistry) { this.functionRegistry = functionRegistry; } async ...
Mert Aydın's user avatar
0 votes
0 answers
16 views

Why fetch json parsing is slower when the browser network is slowed down?

I was running some profiling on a simple browser fetch call and noticed something curious. I'll paste here an example code: const t0 = performance.now(); const response = await fetch('http://...
Dorus's user avatar
  • 495
0 votes
0 answers
33 views

Differentiate fetch errors between time out and page reload

I have the following code: await fetch(url, payload) .then(raw => raw.json()) .then(res => { response = res; console.log("response:", response); }) ....
ajthealchemist's user avatar
0 votes
0 answers
18 views

How to fix Firestore CORS issues only appearing on reload

I have an application created with React/Next and Firebase, using Firestore for document storage. This is a simple application with only three pages, that takes in travel details from the user (on the ...
heia's user avatar
  • 1
0 votes
1 answer
27 views

Why is the result of this fetch request in Next.js not cached?

I have the following server component in Next.js: export default async function Home() { async function fetch_visits() { return ( await ( await fetch( 'https://...
Chong Lip Phang's user avatar
1 vote
1 answer
27 views

Value comes back 'undefined' on first component render

I am attempting to do a book search with the bookTitle that users type in or select from the page. On first render bookTitle comes back undefined, which then pulls up some random kids book called '...
Cadhig's user avatar
  • 25
0 votes
0 answers
15 views

Fetch data to server that is hosted by Vercel

I'm testing to fetch data from client to server that I host by Vercel. The code of server is: from flask import Flask, request, jsonify from flask_cors import CORS app = Flask(__name__) cors = CORS(...
tqtcse's user avatar
  • 1
0 votes
0 answers
13 views

unable to fetch response using fetch api , Uncaught (in promise) TypeError: Failed to fetch [duplicate]

i was trying to build chrome extension that should automatically select first available date and first available timeslot in calendar whenever a request sent to server , it will recieve response which ...
jaya krishna's user avatar
0 votes
0 answers
24 views

ReadableStream from Fetch API not consuming entire data

I am trying to use Fetch API's stream capability to read streaming data from backend and use it, based on this. My code is structured as: function init() { container = document.createElement("...
Mandroid's user avatar
  • 7,130
0 votes
0 answers
30 views

Broken pipe error while ajax request is being sent to django

I'm creating a speedcube timer with django, basically it shows a way to scramble my cube and I can time how long it takes me to solve it. At the moment I've just implemented the timer function with js....
Abdiel Fonseca Peña's user avatar
-1 votes
0 answers
43 views

Why does does my Blob come up as empty when the data is being pass through? [duplicate]

Ok. I have this code: const response = await fetch(source, { headers: { "Content-Type": "application/octet-stream", }, }); ...
ProfessorFinesse's user avatar
-1 votes
0 answers
23 views

Checking if username and/or email are in use javaScript [duplicate]

I am creating a webpage for a school proyect and I am having issues with the register tab. A friend is coding the backend on pgAdmin and its running on a Vercel server. The issue is that every time a ...
Federico Gaubeca Klix's user avatar
0 votes
0 answers
17 views

Different array between cmd and Chrome console.log()

I'm trying to do an app that fetches data from an API. When I use my API, all the data are there: API Data from DataBase But when I'm trying to fetch all those data from my Next.js app, I get 2 ...
Gormec's user avatar
  • 1
0 votes
0 answers
5 views

Nuxt Middleware not firing outside of development server

I am trying to call a News API when the user goes to the the news page. I would usually use asyncData or fetch to call the API, but the API is handled by their client and I kept running into CORS ...
callum21's user avatar
0 votes
1 answer
29 views

How to do one auth call for multiple components

I have a React app something like this: function App() { return ( <div> <ExternalContent id="1"/> <ExternalContent id="2"/> <...
derekantrican's user avatar
-1 votes
0 answers
33 views

Why is my async function not awaiting properly and returning undefined? [duplicate]

I'm working with an async function in JavaScript, but it seems like the function isn’t awaiting the asynchronous operation correctly. As a result, it's returning undefined instead of the expected ...
Hasala Kithmina's user avatar
0 votes
1 answer
33 views

Flask and Fetch() - keep loading a new blank html instead of updating current page

I am trying to write a text-based Pokemon game using Python and Flask. I would like the user to be able to choose their Pokemon by clicking a button on the webpage, this user_pokemon_name variable to ...
user26782974's user avatar
-1 votes
0 answers
16 views

Interaction with AWS lambda function and Ionic application

I am making an Ionic application, which communicates with an aws lambda function which i have made, to get some information about the app. I am currently facing the following problem: If i use the ...
Giannis Petsis's user avatar
0 votes
0 answers
72 views

Fetch request "Load failed" error in Safari on iOS devices. (Stimulus)

I have been having issues with a fetch request in my Stimulus controller. Whenever we try to send a fetch request we get a network error "Load failed" error. The fetch request is supposed to ...
obreil54's user avatar
1 vote
0 answers
24 views

Revalidate data from cms at request time in next.js 14

I am using the Hasnode CMS graphql api but fetching it like a normal api in next.js, the problem is that for some reason next.js caches the fetch request in production, and it doesn't show the most ...
nicoiscoding's user avatar
0 votes
1 answer
54 views

Request Method: POST Status Code: 400 Bad Request Referrer Policy: strict-origin-when-cross-origin

import { Restaurant } from "@/types" import { useAuth0 } from "@auth0/auth0-react" import { useMutation } from "@tanstack/react-query" import { toast } from "sonner&...
kiko byte's user avatar
0 votes
2 answers
58 views

CORS issue from React frontend calling Flask server

I'm building an app in React and I had some Python code I wanted to run, so I decided to turn the Python code into a small Flask server so I could access its results via an HTTP request. The ...
awdreg's user avatar
  • 41
0 votes
1 answer
30 views

Nextjs fetch received by different nestjs endpoint

I'm doing a simple fetch on an internal page (like a product page), using a slug (like 'my-product') in the body, and it stopped working properly. By debuggin it with the help of postman, making the ...
Victor Souto's user avatar
0 votes
0 answers
24 views

React application is reloading page after api response

On button click After making python api call, react application is getting reloaded. tried adding e.preventDefault still no luck app.py returns below code return jsonify({"file_path": ...
satyanarayan mishra's user avatar
0 votes
0 answers
20 views

How to write a simple async test for fetch api call in React Testing Library

I have a React component as follows. The fetch api is called once the dom load is complete. I want to display the data as a list which is received from the api call. import React, { useEffect, ...
Sonal's user avatar
  • 3
-3 votes
2 answers
87 views

Asynchronous Fetch in Javascript

I need to make a call to a file named chiamata_preventivo.php, which takes about 10 minutes to respond. While this page is being processed, I would like to open a new tab to dashboard.php to allow the ...
kevinpcf's user avatar
-3 votes
0 answers
28 views

Fetch API: TypeError: Cannot read properties of null (reading 'getReader') [duplicate]

I am trying to use fetch API as: fetch(".../data", {mode: 'no-cors'}) // Retrieve its body as ReadableStream .then((response) => { const reader = response.body.getReader(); // ...
Mandroid's user avatar
  • 7,130
0 votes
1 answer
35 views

How do I use a fetch response object with fluent-ffmpeg?

The following code throws an error: async start(url, user = null, pass = null) { console.log('Transcoding:', url); const headers = {}; try { if (...
chovy's user avatar
  • 75k
2 votes
0 answers
26 views

CSP Header Nonce is not showing up after adding it in next.config.mjs?

New to CSP headers : I'm working on a nextjs application I have added this csp in middleware.ts const nonce = Buffer.from(crypto.randomUUID()).toString('base64') const cspHeader = ` default-src '...
Sriram Prasanth's user avatar
0 votes
0 answers
17 views

"Type Error Fetch Failed" when I start the server in next js

Can anyone help me around this error I am getting this whenever I start the dev server at least in most cases. I am using next-auth and vercel postgres package which is used for just authenticating ...
Saad Masood's user avatar
0 votes
1 answer
118 views

How to stream LLM response from FastAPI to React?

I want to stream an LLM (ollama) response using fastapi and react. I can successfully get an answer from the LLM without streaming, but when I try to stream it, I get an error in react. The LLM answer ...
Simon1's user avatar
  • 678
0 votes
1 answer
57 views

What are the advantages of using Headers object instead of just using object literals when using fetch?

When setting request headers while using the fetch API, I can just use object literals or use a Headers object: You can pass an object literal here containing header-name: header-value properties: ...
Qiulang's user avatar
  • 11.8k
0 votes
2 answers
69 views

Make sure script waits for await fetch result before continuing

I need to make a post request so I'm using the fetch request below. async function record(recording_url, options) { const recording_outcome = await fetch (recording_url, options); const ...
Jcarty-Pinner's user avatar

1
2 3 4 5
125