https://discord.gg/botpress logo
#🤝help
Axios error on calling api
# 🤝help
f

flat-nail-33989

07/07/2023, 6:58 PM
Hi I am calling a third party api, but receiving this error - [AxiosError: Network Error] Please suggest how to handle this. Thanks!
b

better-beach-62970

07/07/2023, 7:05 PM
Having the same issue when trying to route to StackAI
f

flat-nail-33989

07/07/2023, 8:05 PM
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

mammoth-memory-88325

07/07/2023, 8:07 PM
Im getting this too!
f

famous-memory-11286

07/07/2023, 8:10 PM
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

flat-nail-33989

07/07/2023, 8:15 PM
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

loud-tiger-92573

07/08/2023, 8:21 AM
same issue here @acceptable-kangaroo-64719 @rich-battery-69172 @witty-football-93730 can you guys help?
b

better-beach-62970

07/08/2023, 11:23 AM
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

proud-salesmen-52906

07/08/2023, 11:39 AM
Same
I think it might be becouse of a new update
j

jolly-church-25277

07/08/2023, 2:36 PM
I'm having the exact same issue. Trying to call a Zapier webhook and getting an Axios network error
r

refined-memory-3044

07/08/2023, 3:06 PM
Having same issues, anyone managed to solved?
g

glamorous-eve-70875

07/08/2023, 3:49 PM
Same issue
m

mammoth-memory-88325

07/08/2023, 3:49 PM
24hr with the same problem now
Losing leads as we speak...
s

sparse-plumber-3536

07/08/2023, 3:50 PM
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

glamorous-eve-70875

07/08/2023, 6:54 PM
Has this been fixed?
d

delightful-fall-62994

07/08/2023, 6:59 PM
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

white-finland-3512

07/08/2023, 7:12 PM
Does fetch work for BotPress?
d

delightful-fall-62994

07/08/2023, 7:25 PM
Yeah got the idea from Botpress support themselves. Fetch is a native Java scricpt command
f

flat-nail-33989

07/08/2023, 7:27 PM
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

delightful-fall-62994

07/08/2023, 7:28 PM
I'm getting 405 for Zapier not Stach AI still working on that end myself
r

ripe-processor-4740

07/08/2023, 8:27 PM
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

great-journalist-23917

07/08/2023, 9:37 PM
Same
a

adorable-electrician-53052

07/09/2023, 12:49 AM
I am having a an error: [AxiosError: Network Error]
When will it be fixed
p

powerful-whale-66945

07/09/2023, 2:46 AM
same here
h

helpful-rain-9982

07/09/2023, 3:06 AM
welcome to development this happens all the time whenever i try to build something
e

echoing-cat-6473

07/09/2023, 5:30 AM
I'm having the same issue with my Zapier webhook url
a

adorable-electrician-53052

07/09/2023, 5:36 AM
Is it a problem with zapier or botpress or stack ai
e

echoing-cat-6473

07/09/2023, 5:37 AM
I think its with Botpress but I'm not sure
a

adorable-electrician-53052

07/09/2023, 5:37 AM
Where is everyone getting this info from
I need this bot done for a client
e

enough-lighter-35270

07/09/2023, 5:47 AM
I think it's with botpress. I was using a third party api , it's too getting the same error .
a

adorable-electrician-53052

07/09/2023, 5:48 AM
is there a botpress developer on here
p

proud-journalist-55853

07/09/2023, 6:06 AM
The same error - Axios Requests (1 items - 1 error) GET https://api.bing.microsoft.com/: Error: Network Error
r

rough-magician-49397

07/09/2023, 6:57 AM
Known error from botpress. Try using other than axios requests (fetch)
h

helpful-rain-9982

07/09/2023, 8:46 AM
copy your code paste it in gpt prompt and add "replace it with fetch"
b

better-beach-62970

07/09/2023, 9:59 AM
It’s clear this issue is happening with everyone. Wen fix?
Trying that now. Thanks buddy
h

helpful-rain-9982

07/09/2023, 10:06 AM
i found the solution in general section credit to @little-translator-50218
b

better-beach-62970

07/09/2023, 10:07 AM
Legend 👏👏👏
l

little-translator-50218

07/09/2023, 10:08 AM
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

better-beach-62970

07/09/2023, 10:40 AM
I just did that and it worked. Thank you!
p

proud-salesmen-52906

07/09/2023, 12:18 PM
still not working
It cant recongnize fetch
[Syntaxerror,unexpected error token "catch"]
b

better-beach-62970

07/09/2023, 12:39 PM
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

proud-salesmen-52906

07/09/2023, 12:40 PM
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

proud-journalist-55853

07/09/2023, 12:40 PM
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

better-beach-62970

07/09/2023, 12:42 PM
Weird bro did you try the code he shared above and ask GPT to "replace with fetch"?
p

proud-salesmen-52906

07/09/2023, 12:42 PM
yes
b

better-beach-62970

07/09/2023, 12:42 PM
For me replace with fetch worked let me share my code it may help
p

proud-journalist-55853

07/09/2023, 12:42 PM
Yes
p

proud-salesmen-52906

07/09/2023, 12:42 PM
I doesnt recognize it i will try "try" instead
b

better-beach-62970

07/09/2023, 12:42 PM
// 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

proud-salesmen-52906

07/09/2023, 12:43 PM
I hate botpress it works now
b

better-beach-62970

07/09/2023, 12:43 PM
LFGGGG
p

proud-salesmen-52906

07/09/2023, 12:43 PM
A minute ago I DID NOT WORK
I will publish it rn before i wake up and get the same issue
b

better-beach-62970

07/09/2023, 12:44 PM
Devs doing something? xD
w

wonderful-wolf-33901

07/09/2023, 12:45 PM
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

proud-salesmen-52906

07/09/2023, 12:45 PM
Your putting it on Ai task?
w

wonderful-wolf-33901

07/09/2023, 12:46 PM
yea
p

proud-salesmen-52906

07/09/2023, 12:46 PM
{{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

better-beach-62970

07/09/2023, 12:47 PM
Bot is also working on the webversion now, it wasn't 5 minutes ago cool.
p

proud-salesmen-52906

07/09/2023, 12:47 PM
They rememberd they had to fix this and fixed
it
Watch in 10 minutes something else wont work
I love this platform
w

wonderful-wolf-33901

07/09/2023, 12:50 PM
done these steps, but its giving me value evaluated to undefined error
i have defined it in the header of the code
p

proud-salesmen-52906

07/09/2023, 12:51 PM
like this?
w

wonderful-wolf-33901

07/09/2023, 12:51 PM
yea
p

proud-salesmen-52906

07/09/2023, 12:51 PM
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

wonderful-wolf-33901

07/09/2023, 2:38 PM
does the online version of botpress studio have axios installed ?
i am getting an error that suggest i need to install the library
c

cool-flag-29807

07/09/2023, 4:00 PM
I believe axios error is still exist for everyone. Can anyone check its not working on you also?
g

great-journalist-23917

07/09/2023, 5:14 PM
I'm still getting the same error as yesterday.
w

wonderful-wolf-33901

07/09/2023, 5:17 PM
is there an app version of botpress? or is there only an online version
g

great-journalist-23917

07/09/2023, 5:24 PM
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

ripe-processor-4740

07/09/2023, 5:34 PM
any alternative to axios that you can use in botpress cloud ?
l

little-stone-63265

07/09/2023, 5:51 PM
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

flat-nail-33989

07/09/2023, 6:44 PM
Telegram webhook is not taking in some flows. Half flow works and then it just stops. Anyone facing similar issues?
b

better-beach-62970

07/10/2023, 12:09 AM
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

chilly-car-26524

07/10/2023, 1:24 AM
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

damp-forest-63651

07/10/2023, 2:38 AM
i have this same error with axios error, jut figured out, it was related to axios code
l

lively-elephant-36806

07/10/2023, 6:30 AM
Is anyone still having issue with the axios.post function?
Still not working
c

chilly-activity-74013

07/10/2023, 6:32 AM
I am getting the exact same issue. Tried everything. Included headers for cross-origin as well. It works fine in postman,
a

adorable-electrician-53052

07/10/2023, 6:48 AM
Yes Still broken
p

proud-journalist-55853

07/10/2023, 7:11 AM
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

numerous-terabyte-74924

07/10/2023, 7:12 AM
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

best-cricket-48770

07/10/2023, 8:19 AM
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

proud-journalist-55853

07/10/2023, 8:26 AM
Yep
p

proud-salesmen-52906

07/10/2023, 8:38 AM
same
a

adorable-electrician-53052

07/10/2023, 9:05 AM
errorError executing action "inline-ins-27028531aa.js" in flow:Main:node:Standard1 [Error, api-error: resposne is not defined]
s

sparse-zebra-64065

07/10/2023, 9:12 AM
same here too
l

little-translator-50218

07/10/2023, 11:55 AM
@best-cricket-48770 @proud-journalist-55853 @proud-salesmen-52906 @adorable-electrician-53052 @sparse-zebra-64065 - fetch works. ignore the highlight
p

proud-salesmen-52906

07/10/2023, 11:59 AM
i would love it to work but it just doesnt
l

little-translator-50218

07/10/2023, 12:00 PM
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

proud-salesmen-52906

07/10/2023, 12:01 PM
Is there anything else i can try besides fetch and axios
r

red-musician-97391

07/10/2023, 12:01 PM
axios isn't working, how can I try fetch? anyone a example code?
r

rough-magician-49397

07/10/2023, 12:30 PM
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

sparse-zebra-64065

07/10/2023, 12:45 PM
Nah, it doesn't work here. It's giving "Cannot find name 'fetch'. " (the same error that @best-cricket-48770 posted about)
b

best-needle-13595

07/10/2023, 1:07 PM
Ignore it, fetch "works" anyway
"Works" because it's still broken atm
It's just a bug of the code editor
n

nice-answer-41744

07/10/2023, 1:09 PM
Having same issues with Axios get. anyone managed to solved?
Using fetch Im getting error: [Error, api-error: Failed to fetch]
r

refined-memory-3044

07/10/2023, 2:43 PM
same issue, need help to fix this for zapier integration
a

acceptable-gold-88171

07/10/2023, 3:04 PM
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

best-cricket-48770

07/10/2023, 3:41 PM
A fix for which problem exactly?
r

rough-magician-49397

07/10/2023, 3:55 PM
Axios network error
g

gorgeous-fall-40930

07/13/2023, 11:22 AM
im having an axios network error
im just trying to call zapier to put the caputed email in a spreadsheet
d

dazzling-park-15675

07/30/2023, 10:52 AM
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

acceptable-kangaroo-64719

08/03/2023, 10:37 AM
what's your code?
123 Views