Could you please increase the functions timeout for the website: trublue.netlify.app
Also, there is VERY strange situation with background functions:
Looks like they do not support identity, the according variables are empty. We solved that by decoding the token in the Authorization header.
There is very strange behavior of the function - it sends error 500 and does not write anything in the log. We are trying to upload a file by sending it as a payload to the background function. We know that there is 6Mb limit of the payload size, but error 500 is returned even if the file is only 400kb (500kb base64-encoded)! Only very small files are processed, less than 30kb maybe.
Can you fix that? We hope to be able to work with files of at least 4Mb (to safely keep the payload size under the 6Mb limit).
Thanks so much for reaching out. Sorry to hear you are having issues with background functions.
I have increased your functions timeout for the website you listed above. As I am not a background functions expert, I am going to let a different member of the Support team step in with some debugging advice and next steps.
Are you using the event-based triggers for these functions (like identity-login-background)? I am able to get Identity information in event.body.payload for that. If you’re using context.clientContext, it won’t be available in that.
About the file size issue, I think background functions have a 256 KB payload limit and not 6 MB.
Hello!
Thanks for the answer, we decided to upload files via s3 directly and then pull them in background lambda, so that issue kind of is solved.
If a background function has 256k that could explain the problem with it anyway.
As for the identity, we call lambda functions directly, not the event-based trigger.
When calling normal lambda, identity is accessible in context.clientContext, but when calling the same code written as background lambda, context.clientContext is undefined.
What do you mean by saying
Identity information in event.body.payload
event.body contains the request body that was sent to lambda from the client-side. We are able to get the Authorization: Bearer ... header and decode JWT but it’s not verified against netlify identity in that case, right? So we can’t trust it and can’t rely on that information because it could be faked from the client-side.
What I meant was, if you used event-based functions, you’d get Identity data (verified by Netlify) in the event.body.payload object. You’re right, in background functions, you don’t have access to context.clientContext. So if you need to access that data, you might have to rely on event based functions.