Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

872
Vistas
How to pass value of NODE_EXTRA_CA_CERTS to AWS Lambda deployed with Serverless?

I am deploying a Node AWS Lambda with Serverless. Due to the internal requirements of the institution in which this code will be run, I need to pass extra certificates. The only solution I've been able to find is to pass NODE_EXTRA_CA_CERTS as a CLI argument. Using typical environmental variables (defined, for example, in dotenv) does not work because by that point in Node the certificates have already been configured.

My extra certs are in MyCerts.pem in the project root, and the Lambda function I'm trying to run is called function1. Running the Lambda locally with NODE_EXTRA_CA_CERTS=./MyCerts.pem npx serverless invoke local -f function1 -l works correctly. However, once I deploy to AWS using npx serverless deploy -v, I cannot find a way to properly include these additional certs, including by invoking from the CLI using NODE_EXTRA_CA_CERTS=./MyCerts.pem npx serverless invoke -f function1 -l.

I've tried everything I can think of and am at a loss. Can someone help?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

I think this should definitely be possible in AWS Lambda.
There is an example on dev.to [1] that is similar to your use case. However, they are using .NET Core and AWS SAM, but it should be easy to port the solution to serverless and Node.js.

Basically, you need two steps:

  1. Create a Lambda layer containing your additional certificate file [2][3]
  2. Add the NODE_EXTRA_CA_CERTS environment variable to your serverless.yml and point the path to the file you uploaded to your Lambda layer [4]

References

[1] https://dev.to/leading-edje/aws-lambda-layer-for-private-certificates-465j
[2] https://www.serverless.com/plugins/serverless-layers
[3] https://www.serverless.com/blog/publish-aws-lambda-layers-serverless-framework
[4] https://www.sinservidor.com/blog/sinservidor-v1.2.0

over 4 years ago · Santiago Trujillo Denunciar

0

As an example let's set two environment variables in a function

aws lambda update-function-configuration --function-name NODE_EXTRA_CA_CERTS \

--environment "Variables={BUCKET=my-bucket,KEY=file.txt}"

To get the current configuration use

aws lambda get-function-configuration --function-name my-function

Here we see if our NODE_EXTRA_CA_CERTS variable was set

over 4 years ago · Santiago Trujillo Denunciar

0

I ran into this problem too and taking Martin Loper's inputs, I had set environment variable NODE_EXTRA_CA_CERTS prefixed with /var/task/ and then the path inside my lambda code base where the cert is actually located. e.g. it would like like /var/task/certs/myCustomCA.pem if I had a folder certs in my lambda with myCustomCA.pem.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda