Axios error on calling api
# 🤝help
f
Hi I am calling a third party api, but receiving this error - [AxiosError: Network Error] Please suggest how to handle this. Thanks!
b
Having the same issue when trying to route to StackAI
f
Yeah the more elaborate error message that I getting is this: Network Error { transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, adapter: [ 'xhr', 'http' ], transformRequest: [ [Function] ], transformResponse: [ [Function] ], timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, env: { FormData: [Function: FormData], Blob: [Function: Blob] }, validateStatus: [Function: validateStatus], headers: { Accept: 'application/json, text/plain, */*', 'x-app-id': undefined, 'Content-Type': 'application/json', authorization: 'Basic NjI0NjU1OmRhMDJhMDM0MmJhMTQxNjIzNzM5MWI5NDNhNmU0MGNk' }, withCredentials: false, baseURL: '', method: 'post', url:
m
Im getting this too!
f
Chrome returns the following error: has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request
f
This could be botpress server issue maybe. I tried the spoonacular api template, but it is also returning the axios error on the call api node
l
same issue here @acceptable-kangaroo-64719 @rich-battery-69172 @witty-football-93730 can you guys help?
b
Weird, the same code I'm using was working yesterday afternoon. Didn't change anything and it just started to give network error. "Error executing action "inline-ins-a27d612733.js" in flow:Main:node:StackAIQuery [Error, stack-error: AxiosError: Network Error] Entering workflow (flow:Error) [node:Entry] from (flow:Main) [node:StackAIQuery]"
p
Same
I think it might be becouse of a new update
j
I'm having the exact same issue. Trying to call a Zapier webhook and getting an Axios network error
r
Having same issues, anyone managed to solved?
g
Same issue
m
24hr with the same problem now
Losing leads as we speak...
s
Having a similar issue while calling Flowise hosted on AWS Lightsail. I printed out the error - https://pastebin.com/thyYzp8H
I called the api from another browser app and its working normally, seems to be an issue with botpress. Here is the js code I used for calling the api. There may be some error in here that may be causing the issue - https://pastebin.com/eE3gxKWz
g
Has this been fixed?
d
I managed to get a work around using 'fetch' instead of Axios for stack AI, but I haven't been able tot get it to work for zapier yet
w
Does fetch work for BotPress?
d
Yeah got the idea from Botpress support themselves. Fetch is a native Java scricpt command
f
it worked for some time for me, but now it's started giving error 405
for the same code that was working a few minutes back 😦
d
I'm getting 405 for Zapier not Stach AI still working on that end myself
r
Getting the same info[AxiosError: Network Error]. Tyring to connect to make.com Was working fine yesterday morning now doesn't work. Trying to understand why.
g
Same
a
I am having a an error: [AxiosError: Network Error]
When will it be fixed
p
same here
h
welcome to development this happens all the time whenever i try to build something
e
I'm having the same issue with my Zapier webhook url
a
Is it a problem with zapier or botpress or stack ai
e
I think its with Botpress but I'm not sure
a
Where is everyone getting this info from
I need this bot done for a client
e
I think it's with botpress. I was using a third party api , it's too getting the same error .
a
is there a botpress developer on here
p
The same error - Axios Requests (1 items - 1 error) GET https://api.bing.microsoft.com/: Error: Network Error
r
Known error from botpress. Try using other than axios requests (fetch)
h
copy your code paste it in gpt prompt and add "replace it with fetch"
b
It’s clear this issue is happening with everyone. Wen fix?
Trying that now. Thanks buddy
h
i found the solution in general section credit to @little-translator-50218
b
Legend 👏👏👏
l
Here is the solution @helpful-rain-9982 is talking about.
Copy code
js
try {
  const response = await fetch("URL_HERE", {
    method: "POST", // or "GET"
    headers: {
      "content-type": "application/json",
      "authorization": `Bearer ${API_KEY}` // <- ONLY USE THIS IF YOU NEED IT
    },
    body: JSON.stringify(data) // <- ONLY USE IF YOU HAVE DATA TO SEND
  })
  const data = await resposne.json()
  workflow.response = data // Handle your data however you want
} catch (error) {
  if (error instanceof Error) {
    throw new Error(`api-error: ${error.message}`)
  }
  throw new Error(`api-error: ${error}`)
}
b
I just did that and it worked. Thank you!
p
still not working
It cant recongnize fetch
[Syntaxerror,unexpected error token "catch"]
b
Now I have got another bug. My bot is working perfectly on botpress but on the web it just doesn't do anything lol
p
Is there a chance i can go back to a older version
I cant wait for botpress team to take 5days to fix this issue
p
It doesn't work for me either. It constantly throws an error - errorError executing action "inline-ins-77d9cf9bff.js" in flow:Main:node:Call-API [Error, api-error: api-error: 404]. I checked and rechecked the key and endpoint 10000times. Everything is fine. What bothers me and maybe it could be the problem - env.apiKey from Configuration variables is not being passed. When I cover with the mouse cursor over the env.apiKey variable in the code editor, it says (property) ConfigVariables.apiKey: string. Current Value: nothing. Can It be that apiKey value is not being pulled, and as a result - error404?
In my case Bot is working on the web, but caruosels are not being displayed
b
Weird bro did you try the code he shared above and ask GPT to "replace with fetch"?
p
yes
b
For me replace with fetch worked let me share my code it may help
p
Yes
p
I doesnt recognize it i will try "try" instead
b
// Add your stack AI endpoint URL in place of "YOUR_STACK_AI_ENDPOINT_URL" const endpoint = "YOUR_STACK_AI_ENDPOINT_URL"; // Add your stack AI API key in place of "YOUR_API_KEY_HERE" const apiKey = "YOUR_API_KEY_HERE"; const headers = { Authorization:
Bearer ${apiKey}
, "Content-Type": "application/json" }; const data = { "in-0": workflow.question }; try { const response = await fetch(endpoint, { method: "POST", headers: headers, body: JSON.stringify(data) }); if (!response.ok) { throw new Error(
stack-error: ${response.status} ${response.statusText}
); } const result = await response.json(); workflow.apiResponse = result["out-0"]; } catch (error) { throw new Error(
stack-error: ${error}
); }
p
I hate botpress it works now
b
LFGGGG
p
A minute ago I DID NOT WORK
I will publish it rn before i wake up and get the same issue
b
Devs doing something? xD
w
Hi, i have an issue with displaying the output of the information AI has fetched, i am using this line to print all data for now. this is the code {{JSON.stringify(event.state.session.current_workflow.variable_values.recipeInfo)}} can someone help please
p
Your putting it on Ai task?
w
yea
p
{{event.state.session.fullHistory}}
try this
and if it doesnt work but this code above ai task into execute code
const fullHistory = _.get(event, 'state.session.fullHistory'); workflow.fullHistory = fullHistory;
b
Bot is also working on the webversion now, it wasn't 5 minutes ago cool.
p
They rememberd they had to fix this and fixed
it
Watch in 10 minutes something else wont work
I love this platform
w
done these steps, but its giving me value evaluated to undefined error
i have defined it in the header of the code
p
like this?
w
yea
p
go to hooks
in adjust-transcript-user paste this code
// IMPORTANT LEAVE THIS ALONE if (!event.state.session.fullHistory) { event.state.session.fullHistory = '' } event.state.session.fullHistory = event.state.session.fullHistory +
user : ${event.payload.text}
+ '\n'
then go to store-transcript
and paste this
// IMPORTANT LEAVE THIS ALONE if (!event.state.session.fullHistory) { event.state.session.fullHistory = '' } event.state.session.fullHistory = event.state.session.fullHistory +
assistant : ${outgoingEvent.payload.text}
+ '\n'
i dont got anywhere to paste a zapier url
It says "[Failed to fetch]"
w
does the online version of botpress studio have axios installed ?
i am getting an error that suggest i need to install the library
c
I believe axios error is still exist for everyone. Can anyone check its not working on you also?
g
I'm still getting the same error as yesterday.
w
is there an app version of botpress? or is there only an online version
g
So, it won't work in the Botpress Studio chat window, but when I went to the shared web version of my bot, it worked fine.
r
any alternative to axios that you can use in botpress cloud ?
l
Hey bro can you help me with the error please?
Been on it for the past 2 days and got nowhere
Shoot me a DM much appreciated
f
Telegram webhook is not taking in some flows. Half flow works and then it just stops. Anyone facing similar issues?
b
Try this one: // Add your stack AI endpoint URL in place of "YOUR_STACK_AI_ENDPOINT_URL" const endpoint = "YOUR_STACK_AI_ENDPOINT_URL"; // Add your stack AI API key in place of "YOUR_API_KEY_HERE" const apiKey = "YOUR_API_KEY_HERE"; const headers = { Authorization:
Bearer ${apiKey}
, "Content-Type": "application/json" }; const data = { "in-0": workflow.question }; try { const response = await fetch(endpoint, { method: "POST", headers: headers, body: JSON.stringify(data) }); if (!response.ok) { throw new Error(
stack-error: ${response.status} ${response.statusText}
); } const result = await response.json(); workflow.apiResponse = result["out-0"]; } catch (error) { throw new Error(
stack-error: ${error}
); }
Yes I found some bugs too
Sure buddy I will try my best. Added you as friend please accept
c
Im not a developer but I copied code to make an api call to zapier so that I can push lead info to Google sheets.. for some reason its not working though...
anyone able to assist? Im seeing some people are saying that the axio issue was fixed
d
i have this same error with axios error, jut figured out, it was related to axios code
l
Is anyone still having issue with the axios.post function?
Still not working
c
I am getting the exact same issue. Tried everything. Included headers for cross-origin as well. It works fine in postman,
a
Yes Still broken
p
Well, it seems we'll have to wait till Gordy updates us all that the issue has been solved. So, @acceptable-kangaroo-64719 please let us know in due time
n
actually now exactly like this testing with free weather api, works great try { const response = await fetch( 'https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41¤t_weather=true&hourly=temperature_2m,relativehumidity_2m,windspeed_10m', { method: 'GET' // or "GET" } ) const data = await response.json() workflow.weather = data // Handle your data however you want } catch (error) { if (error instanceof Error) { throw new Error(
api-error: ${error.message}
) } throw new Error(
api-error: ${error}
) }
b
Do your BotPress editors also highlight 'fetch' with the message: Cannot find name 'fetch'. ??
Adding an import seems to cause other issues, but maybe I'm missing something simple
p
Yep
p
same
a
errorError executing action "inline-ins-27028531aa.js" in flow:Main:node:Standard1 [Error, api-error: resposne is not defined]
s
same here too
l
@best-cricket-48770 @proud-journalist-55853 @proud-salesmen-52906 @adorable-electrician-53052 @sparse-zebra-64065 - fetch works. ignore the highlight
p
i would love it to work but it just doesnt
l
For some people it works and some it doesn't from what I'm seeing and the Botpress team has been offline since Friday. So, not sure whats going on
p
Is there anything else i can try besides fetch and axios
r
axios isn't working, how can I try fetch? anyone a example code?
r
Guys if axios is not working, take your code, paste it in chatgpt and ask: can you use fetch instead of axios. Its the easiest solution ATM. Botpress staff have lots of work, im pretty sure they are looking into it
s
Nah, it doesn't work here. It's giving "Cannot find name 'fetch'. " (the same error that @best-cricket-48770 posted about)
b
Ignore it, fetch "works" anyway
"Works" because it's still broken atm
It's just a bug of the code editor
n
Having same issues with Axios get. anyone managed to solved?
Using fetch Im getting error: [Error, api-error: Failed to fetch]
r
same issue, need help to fix this for zapier integration
a
Hello! We published a fix a few minutes ago. The issue should be solved now. Please let us know if this is still happening! Also, thanks for sharing the Fetch workaround!!
b
A fix for which problem exactly?
r
Axios network error
g
im having an axios network error
im just trying to call zapier to put the caputed email in a spreadsheet
d
I am getting this error message and have been unable to resolve: Error executing action "inline-ins-c915058d70.js" inflow:Main:node:classify-email [Error, Check dependency list! Synchronous require cannot resolve module 'axios'. This is the first mention of this module!]
a
what's your code?
305 Views