I'm trying to find documentation describing restrictions on what can be safely accessed from within a transaction running within a javascript Foxx micro-service. I had read somewhere (can't find it now) that you can't access anything except what is passed via the transaction parameters array, and you must re-import all node modules that are used within the transaction. I'm curious what I can safely pass into a transaction - such as the ArangoDB database object itself (instead or re-importing it), why these restrictions exist, and what the performance implications are (object marshaling?). In my testing on a single-node server, it seems that accessing externally defined variables does work, so I assume these restrictions have to do with more complex configurations of the database server/cluster.
Thanks!
I had read somewhere (can't find it now) that you can't access anything except what is passed via the transaction parameters array
This applies to UDFs (user-defined functions), not Foxx micro-services.
I believe that all the cautions about Foxx are in the manual:
https://docs.arangodb.com/3.11/develop/foxx-microservices/
In particular:
"you should not rely on server-side state (other than the database itself) between different requests as there is no way of making sure consecutive requests will be handled in the same context."
"Because the JavaScript code is running inside the database ... all Foxx and ArangoDB APIs are purely synchronous and should be considered blocking."