Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SFR-2196: Expose New Relic env vars for runtime #531

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ ENV APP_ENV $APP_ENV
FROM base AS runner
WORKDIR /app

# We need to expose these ARG again, they are needed for browser monitor
ARG NEW_RELIC_APP_NAME
ARG NEW_RELIC_LICENSE_KEY
ENV NEW_RELIC_APP_NAME $NEW_RELIC_APP_NAME
ENV NEW_RELIC_LICENSE_KEY $NEW_RELIC_LICENSE_KEY

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

Expand Down
7 changes: 7 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const path = require("path");

const nrExternals = require("newrelic/load-externals");

/**
* @type {import('next').NextConfig}
*/
Expand All @@ -24,6 +26,11 @@ const nextConfig = {
}
}

// In order for newrelic to effectively instrument a Next.js application,
// the modules that newrelic supports should not be mangled by webpack. Thus,
// we need to "externalize" all of the modules that newrelic supports.
config = nrExternals(config);

return config;
},
sassOptions: {
Expand Down
Loading