I have nestjs server exposed as lambda. How can I ...
# help
k
I have nestjs server exposed as lambda. How can I pass environment variables to that lambda/nestjsapp?
Copy code
const api = new sst.Api(this, "Api", {
      routes: {
        $default: {
          function: {
            handler: "src/lambda.handler",
          },
        },
      },
    });
Copy code
export async function handler(event) {
  return nestJsAppHandler(event);
}
Copy code
export const handler: Handler = async (
  event: any,
  context: Context,
  callback: Callback,
) => {
  server = server ?? (await bootstrap());
  return server(event, context, callback);
};
f
Does this work?
Copy code
const api = new sst.Api(this, "Api", {
      routes: {
        $default: {
          function: {
            handler: "src/lambda.handler",
            environment: {
              HELLO: "world",
            },
          },
        },
      },
    });