good morning, I created a ubi function in python, but when connecting the ubifunction in HTML and JS I’m having problems, I can’t access args in the main function, can someone help me?
Hello @caiomoraes,
Can you provide additional details as listed below:
- What’s your UbiFunction trigger method, GET or POST? Are you using this same method from the JS code to trigger the function?
- How are you trying to access the args in your function? Can you show us a snippet, both of the function and the JS call?
- Are you calling the function from an HTML canvas widget?
- What’s your account username?
Please provide any additional details that you consider helpful to troubleshoot your issue.
–David
- the trigger method used is post, I’m not very good in front so I don’t know.
- the codes are attached.
- I think yes I will send you all the screens of both the html and the API
- The user is JKControl
NOTE: rfid is the API and the notepad is the front endAPI-frontend.zip (7.8 KB)
@caiomoraes can you point me to the dashboard name where your building this HTML widget? I’d like to have a look at the payload you’re trying to send to the UbiFunction.
I already saw the functions logs but I can’t why you’re not getting any data.
On top of that, after a quick inspection of the JS code, I see that the triggerFunction
makes 2 calls to the UbiFunction, one using JQuery and the other with Fetch, why is that? Don’t you need one only?
–David
good afternoon, how do i see the dashboard? in fact it was without the fatch and did not return the status 200 there with the fatch yes
When I ask for the dashboard is because I’m assuming that you’re running the HTML and JS code in a HTML canvas widget but based on your last message, I believe this is not the case.
Can you clarify where are you running the front-end portion of your application (HTML/JS + UbiFunction)?
I’m not able to upload the photos, but JS, HTML and CSS are inside the ubidots, in the dashboard, in editing, after open editor.
Good morning. There is some email that I can send as photos, here it is not loading.
What’s the dashboard name Caio?
Remember that as a license holder, you can reach out at support@ubidots.com or open at ticket as described in the below article:
Hello @caiomoraes,
Can you test your front-end + function development again? We noticed that our back-end was rejecting the requests from the HTML canvas to your rfid function because a browser CORS problem.
We have since enable said function to be reachable from this widget so it now works as expected, at least the request to the function.
Furthermore, you seem to hace an error in your function because every time one executes it from the HTML canvas, the response is a 502 error code, which means the function broke.
Makes sense?
–David
good afternoon, so now it seems that it is pulling the input data, which are the device label, start and end, but it is not being able to fetch the data. is that something I did on the function?
caio
o erro esta aqui, como não consumiu os dados, ele da erro pois não puxou o timestamp.
in main function:
timestamp = [ts[“timestamp”] for ts in results]