# Lambda Layer Modifications

## [Node](https://docs.sentry.io/.md#node)

When Sentry is added to a Lambda function, the following modifications are made to your Lambda functions:

* The layer for Sentry is added to your Lambdas. Any existing layers are honored and the Sentry layer is appended to the end.

  [![](https://docs.sentry.io/_next/image/?url=%2Fmdx-images%2Flayer-EQWHRKHV.png%23978x192\&w=2048\&q=75)](https://docs.sentry.io/mdx-images/layer-EQWHRKHV.png)

* Sentry adds the following environment variables

  * `NODE_OPTIONS`: This is to preload the `awslambda-auto` module which will automatically initialize Sentry
  * `SENTRY_DSN`: This is set to the [DSN](https://docs.sentry.io/product/sentry-basics/dsn-explainer.md) of your project
  * `SENTRY_TRACES_SAMPLE_RATE`: This sets the [sampling rate](https://docs.sentry.io/platforms/javascript/guides/node/configuration/sampling.md#sampling-transaction-events) for transactions. You can manually edit your environment variables if you want a different sampling rate.

  [![](https://docs.sentry.io/_next/image/?url=%2Fmdx-images%2Fenv_variables-55VGYFH7.png%23846x269\&w=1920\&q=75)](https://docs.sentry.io/mdx-images/env_variables-55VGYFH7.png)

## [Python](https://docs.sentry.io/.md#python)

When Sentry is added to a Lambda function, the following modifications are made to your Lambda functions:

* The layer for Sentry is added to your Lambdas. Any existing layers are honored and the Sentry layer is appended to the end.

  [![](https://docs.sentry.io/_next/image/?url=%2Fmdx-images%2Flayer_python-TKZ367LO.png%233102x680\&w=3840\&q=75)](https://docs.sentry.io/mdx-images/layer_python-TKZ367LO.png)

  And your Runtime handler will point to Sentry's handler that will initialize the SDK for you, and then call your Runtime handler to invoke your function

  [![](https://docs.sentry.io/_next/image/?url=%2Fmdx-images%2Fhandler_python-PYDDZUIW.png%233108x626\&w=3840\&q=75)](https://docs.sentry.io/mdx-images/handler_python-PYDDZUIW.png)

* Sentry adds the following environment variables

  * `SENTRY_INITIAL_HANDLER`: This stores the value of your Runtime handler. If you choose to disable the Sentry layer, this value will be used to set the Runtime handler.
  * `SENTRY_DSN`: This is set to the [DSN](https://docs.sentry.io/product/sentry-basics/dsn-explainer.md) of your project
  * `SENTRY_TRACES_SAMPLE_RATE`: This sets the [sampling rate](https://docs.sentry.io/platforms/python/configuration/sampling.md#sampling-transaction-events) for transactions. You can manually edit your environment variables if you want a different sampling rate.

  [![](https://docs.sentry.io/_next/image/?url=%2Fmdx-images%2Fenv_variables_python-J3OPUPVZ.png%233190x1270\&w=3840\&q=75)](https://docs.sentry.io/mdx-images/env_variables_python-J3OPUPVZ.png)
