https://discord.gg/botpress logo
axios not defined
# 🤝help
l
Autonomous node giving error that axios is not defined { type: 'code_execution_exception', position: [ 12, 9 ], message: 'axios is not defined', stackTrace: ' 001 | // Verify the OTP provided by the user 002 | if (parseInt("761300") === workflow.verifyEmail) { 003 | yield Your email has been successfully verified! Let me now check the availability for your preferred consultation time.; 004 | const bookingDate = "2023-10-27"; // Extracted date from the user\'s preferred appointment time 005 | const result = await axios.post("https://hook.eu2.make.com/------------------", {
In the emulator, the autonomous node is able to run fine, but in published bot it fails const response = await fetch("https://hook.eu2.make.com/f69qw9jtuaza4qsr", { method: "POST", but in the published bot it states type: 'code_execution_exception', position: [ 20, 47 ], message: 'fetch is not defined',
@prehistoric-airplane-85682 - any reason for this behavior
This is very strange behavior first, AN uses axios.fetch method=POST, when prompted to use axios.post. This works in the emulator, but not in the published bot, where it does not know axios.fetch so I shifted to actions. The zod schmea object has 3 keys, and when the input value is log, it shows 6 keys. the 6 keys do not belong to this actions input schema https://cdn.discordapp.com/attachments/1371752004615143424/1371907503163445309/image.png?ex=6824d7ed&is=6823866d&hm=0b6f9ddd4aa19d6ec178391279fce5658b2b72771c36609f8ab9076621be4357& https://cdn.discordapp.com/attachments/1371752004615143424/1371907503415230484/image.png?ex=6824d7ed&is=6823866d&hm=33080e73a77bcf0f52cfa89da5449949dc7dda344c74a4c37c95973d0e0a00c6&
@prehistoric-airplane-85682 is this a bug or I am doing it wrong?
p
Seems like the right way to use actions to me, I'll investigate why this is happening.
On my end it works, have your tried creating a new schema and using that one instead?
l
it is working at my end now, but the schema still has keys from 2 different schemas Input : { emailAddress: 'lijo@gmail.com', userName: 'Lijo Mathew', verifyEmail: 246269, bookingDate: undefined, businessName: undefined, businessEmail: undefined, customerName: undefined, phoneNumber: undefined, bookingTime: undefined } {"scope":"dm"}
actual schema is only this much emailAddress: 'lijo@gmail.com', userName: 'Lijo Mathew', verifyEmail: 246269,
p
Right, it seems like your two actions schemas are combined somehow. I reproduced what I assume you second schema (for booking) looks like and am not having a similar problem. Therefore, I would suggest deleting and recreating your schemas.
l
I tried it did the same thing again.
So Actions and Schema does not as expected
Finally, I made it to work using execute code card. Everytime I have tried to use Autonomous Node to do the actions, it has not never worked
p
Glad you got it working! Indeed, Autonomous Nodes can be frustrating to use as their output is not deterministic.
2 Views