How to get source maps into Sentry for Netlify functions

Hello,

I am using the very basic low-config option to setup my Netlify functions. I am also using the Sentry integration. I would like to get my source maps into Sentry, but I’m not using any type of bundler. Could you please point me in the right direction on how to enable source map generation using Netlify’s built in build plugin? It looks like it is using zip-it-and-ship-it under the hood, and using esbuild. I just don’t know how to configure things to generate source maps.

My very basic toml file:

[build]
publish = “src/public/”

[build.environment]
NODE_VERSION = “18.16.0”
NPM_VERSION = “9.6.4”

[functions]
node_bundler = “esbuild”
directory = “src/functions/”
external_node_modules = [“@sentry/serverless”]

[dev]
autoLaunch = false

If there isn’t an easy way to do this without a bundler, can you please suggest the lowest config way to accomplish this? Is there a starter template out there for webpack/rollup/vite/whatever-is-easiest.

Thanks!
-Frank

Hi Frank,

To configure source map generation using Netlify’s built-in build plugin, you’ll need to add a [[plugins]] section to your netlify.toml file:

[[plugins]]
  package = "netlify-plugin-inline-source"

The [[plugins]] section is used to specify the plugins you want to include. In this case, we’re adding the @netlify/plugin-inline-source plugin, which enables source map generation. See docs.

Hope this helps!