functions.netlify.com
functions.netlify.com copied to clipboard
Using console.log in Netlify JS functions
Hello,
I am not a JS coder, but I know Nim.
So I am trying to use the Nim JS FFI feature to export Nim code to JS and use those as Netlify functions.
My experiments:
As I don't know JS, I think that the console.log
functions should help me better debug the Nim -> JS generated functions. But I cannot make them work (I was hoping that console.log
outputs would show up in the Console when added to the Netlify functions too).
Does console.log work? If yes, can you possible show an example of where you would place it in this Nim generated hello.js
?
I have tried putting 4 console.log
s here [JS source], but they don't show up in the browser console.
OK, so from https://www.netlify.com/docs/functions/#managing-your-functions, I learn that I can see the console.log()
outputs at https://app.netlify.com/sites/SITENAME/functions/FUNCNAME
.
- But only the
console.log
invocations inside theexports.handler
(these) are showing up there. -
These which are outside of that
exports.handler
are not showing up inhttps://app.netlify.com/sites/SITENAME/functions/FUNCNAME
or in the browser Console. Is that expected?
Can you please update the Netlify docs page I linked above with more details?
Thanks!
Sorry to bump this old thread but has there been any updates here? Logging is very important.
This is still and issue. I can trigger a webhook to fire and receive a 200 response from the function but the log output in the Netlify dashboard is empty despite the presence of a few console.log()
which work as intended using netlify dev
.