async function _loadUserApp()

in src/UserFunction.js [202:228]


async function _loadUserApp(appRoot, moduleRoot, module) {
  if (!NoGlobalAwsLambda) {
    globalThis.awslambda = {
      streamifyResponse: (handler, options) => {
        handler[HANDLER_STREAMING] = STREAM_RESPONSE;
        if (typeof options?.highWaterMark === 'number') {
          handler[HANDLER_HIGHWATERMARK] = parseInt(options.highWaterMark);
        }
        return handler;
      },
      HttpResponseStream: HttpResponseStream,
    };
  }

  try {
    return await _tryRequire(appRoot, moduleRoot, module);
  } catch (e) {
    if (e instanceof SyntaxError) {
      throw new UserCodeSyntaxError(e);
    } else if (e.code !== undefined && e.code === 'MODULE_NOT_FOUND') {
      verbose('globalPaths', JSON.stringify(require('module').globalPaths));
      throw new ImportModuleError(e);
    } else {
      throw e;
    }
  }
}