Skip to content

Fix Angular Sentry activation when DISABLE_SENTRY env var is set#7499

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/disable-sentry-in-debug-mode-again
Draft

Fix Angular Sentry activation when DISABLE_SENTRY env var is set#7499
Copilot wants to merge 2 commits intomasterfrom
copilot/disable-sentry-in-debug-mode-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

Angular was ignoring the DISABLE_SENTRY environment variable during Docker builds because it uses compile-time environment files rather than runtime env vars. Docker builds always used environment.prod.ts with enableSentry: true.

Changes

  • Created environment.docker.ts: Production build with enableSentry: false
  • Added docker build configuration to angular.json: Uses environment.docker.ts via fileReplacements
  • Updated Dockerfiles: Conditionally build with --configuration=docker when DISABLE_SENTRY=true build arg is passed
  • No C# changes needed: Already checks DISABLE_SENTRY env var correctly

Behavior

# CI/Testing: Sentry disabled for both Angular and C#
docker build --build-arg DISABLE_SENTRY=true -t eform:test .

# Production: Sentry enabled (default, unchanged)
docker build -t eform:prod .

# Local dev: Sentry disabled (unchanged)
yarn start  # Uses environment.ts with enableSentry: false

The solution maintains backward compatibility—production builds work identically without any build arg changes.

Original prompt

This section details on the original issue you should resolve

<issue_title>Change the loading of Sentry for angular to not be active in debug mode</issue_title>
<issue_description>When using the yarn start on localhost, we don't want sentry to be active, to delay any tests or collect a lot of unwanted information/crashes.

The same goes for CI tests, where it's using the Docker image, so we need to modify the Dockerfile to take an optional argument to disable Sentry from both C# and Angular, so if that argument is given, it does not activate Sentry for both C# and Angular.

It's important that no changes is needed for using the Docker image in production.</issue_description>

<agent_instructions>Maybe some upgrade changes removed the disable functionallity, so we need to make sure that the sentry is disabled for both angular and C# for development/testing using the env variable.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@renemadsen Revisit this issue and figure why angular is still activating sentry even then disable sentry env variable is set to true

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
Copilot AI changed the title [WIP] Change Sentry loading for debug mode in Angular Fix Angular Sentry activation when DISABLE_SENTRY env var is set Feb 2, 2026
Copilot AI requested a review from renemadsen February 2, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change the loading of Sentry for angular to not be active in debug mode

3 participants