dgraph-lambda icon indicating copy to clipboard operation
dgraph-lambda copied to clipboard

BREAKING: feat: make lambda pick up the script from the request body

Open NamanJain8 opened this issue 3 years ago • 7 comments

Earlier, dgraph lambda used to use a predefined lambda script from the file. This poses few limitations on how lambda are handled in multi-tenant environment.

This change makes dgraph-lambda accept source field in the request body. This field will contain the required js script, evaluate it at runtime and execute the query.

NamanJain8 avatar Jul 12 '21 16:07 NamanJain8

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Jul 12 '21 16:07 CLAassistant

<Deleted Comment, Sent as a security vulnerability>

gja avatar Jul 27 '21 18:07 gja

@gja I have been watching this too. I think the direction is good, but maybe a timeout on the script would fix that concern? But still curious what would happen if more than one script was running back to back. Would the second script have to wait on the first, or will the scripts run async? (I understand async still has to wait for a pause in processing script 1 before it can start working on script 2 and then another pause to come back and finish up working on script 1.)

amaster507 avatar Jul 27 '21 18:07 amaster507

I've sent the security vulnerability over to manish and naman. Very happy to chat with you over email.

On Wed, Jul 28, 2021 at 00:07:05, Anthony Master @.***> wrote:

@gja https://github.com/gja I have been watching this too. I think the direction is good, but maybe a timeout on the script would fix that concern? But still curious what would happen if more than one script was running back to back. Would the second script have to wait on the first, or will the scripts run async? (I understand async still has to wait for a pause in processing script 1 before it can start working on script 2 and then another pause to come back and finish up working on script 1.)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dgraph-io/dgraph-lambda/pull/22#issuecomment-887741064, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAIPOT5F3LURLQLIYKZCFDTZ34FDANCNFSM5AHHBHOQ .

gja avatar Jul 27 '21 19:07 gja

Adding a middleware for a timeout in express should solve the problem @NamanJain8 Example - http://expressjs.com/en/resources/middleware/timeout.html

Note - This will give back the control to the server but you still need to close the VM, it will continue to use the resources. Fortunately there is a timeout option is available in the vm package that should do the job

tstreamDOTh avatar Jul 28 '21 10:07 tstreamDOTh

For namespace specific tenant logging- you extend console object or use proxy

tstreamDOTh avatar Jul 28 '21 10:07 tstreamDOTh

This PR has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.

github-actions[bot] avatar Jul 12 '24 01:07 github-actions[bot]