@perry I’ve been having a lot of function based issues. I’m trying to test an event invoked function (submission-created.js) and the behavior is all over the place - some related to the issue here, and some not.
First off, you can see from my function logs the way the logs are cut off randomly in the middle of words. Second, you can see that the last invocation is logging “EVENT BODY” and then “undefined”. Those logs are from several deploys back, but were still logging after changing the lamda function and deploying with a cache clear. Now, as you can see from the deploy log screenshot, I’ve deployed since the last function invocation and I’ve attempted to invoke it again by the same means (submitting a contact form). Now, the function isn’t logging anything at all, event though I have a console log in the function. I’m guessing functions themselves take some time to deploy in AWS, and this is possibly why there is a significant discrepancy in what is logged and what is currently in the repo. I’ve not seen this delay documented anywhere in Netlify docs, however. Assuming that, I then don’t understand why my usage numbers are showing 0 function invocations, even though I have dozens of logs of invocations trying to test this. I see the usage period is beginning today (May 8), but I’ve already logged several invocations just today.
The last thing I want to mention, though it is not directly related to this thread, is that when I AM able to log my
event object, the data is coming back a bit odd.
event.body is returning a base64 encoded string. I’ve attempted to decode it, but it literally just decodes to
[object Object] as in a string… it’s almost as if the payload supposed to be an encoded JSON string, but it’s converting a JS object to a string, i.e.
[object Object], instead before anything gets encoded sent over? Again, it’s sending back “W29iamVjdCBPYmplY3Rd” in the event.body. This appears to be a bug of it’s own, but I wanted to mention it as it’s the reason why I’m trying to log so much into the functions log, as I can’t figure out how to actually get ahold of the form data once my function is invoked.
If you’d like, I can create a new thread for that last bit. Thank you for any insight.