Hi, I’m trying to debug an afterInsert web hook but I can’t seem to view console.log output. I have a console.log statement at the first line of the webhook and can’t seem to find where to view it. I tried Chrome’s developer console while editing data.js and while viewing the table being inserted to. I tried Wix’s and Chrome’s both with the site preview up. Where do you have to be to view back end console output?
I have a POST request endpoint set up and working and added a console.log statement to the first line of that as well. The POST request is being successfully handled and new items are being entered into the collection, so I know the code is executing, but I can’t see the output. Thanks for your time.
Hi,
For backend code, you need to open the browser’s Javascript console. Here’s how to open in Chrome:
Thanks for the reply. Output hadn’t been showing up in Chrome’s javascript console either. Here is what I tried:
I put a console.log statement as the first (executing) line in a known-working POST endpoint and saved and published the site.
While editing http-functions.js I opened Chrome’s javascript console and sent a POST request to the sandbox (_functions-dev) version of the endpoint, which resulted in a new row in the sandbox version of a collection. No sign of the console output.
Next I tried editing the sandbox collection this endpoint inserts to with Chrome’s console open and sent another request. No sign of the console output even though the backend is handling the POST request and inserting a new record.
Lastly I tried previewing the site with both Wix’s developer console and Chrome’s console open and firing off the POST request again. Still no sign of the output.
What am I missing? Thanks.
Please post the URL of your site. Only authorized Wix personnel can get access to your site in the editor.
console.log isn’t displaying anything anywhere for me either
Always better to add this issue as a new post rather than add it to the end of a old post that will soon be two years old!
Have a look at the Wix Support page here about debugging backend code etc and it should explain a lot for you…
https://support.wix.com/en/article/corvid-testing-and-debugging-your-code
If you require any more help with this issue, then please add it as a new post.