Database action script container behaviour

We are planing to setup two identity store and its client/application for dev and stage environment respectively under a tenant. Along with that for resource owner authentication(with realm) will be used to achieve separation of identities. My question is, "does global configuration object is shared across the two custom database connection due to reuse of containers? as I am planning to get the table name from configuration object.

Thanks in advance !

1 Like

Welcome and thank you for posting in Auth0 Community! @alok.ruplag

Auth0 serverless Webtask containers are provisioned from a pool that’s associated with each Auth0 tenant. Each container instance makes available the global object, which can be accessed across all rules that execute within the container instance. The global object acts as a global variable and can be used to define information, or to even define functions, that can be used across all rules (that run in the container) irrespective of the pipeline instance:

global.tokenVerify = global.tokenVerify || function(token, secret) {
     /* The 'jwt.verify' function is synchronous, however wrapping with a promise
      * provides for better error management and integration within the logic
      * flow.
      */
     return new Promise(function(resolve, reject) {
      jwt.verify(
        token,
        secret,{
        clockTolerance: 5},
        function(err, decoded) {
          if (err) {
            reject(err);
          } else {
            resolve(decoded);
          }
      });
    });
   };

See: https://auth0.com/docs/best-practices/rules#global-object