← Back to Cookbook

Connect your GitLab source code to Sentry

Connect GitLab to Sentry so errors point straight at the code that caused them. You'll create an application in GitLab, link groups, and add repositories to unlock code mapping, stack trace linking, and Seer.

Features
Category Workflow, Debugging
Time
~5-10 minutes
Difficulty
Beginner
Steps
5 steps

Before you start

Accounts & access
  • Sentry account with the owner, manager, or admin role (required to install integrations)
  • A GitLab account with owner or maintainer permissions on the group you want to connect
  • Access to a GitLab group (on gitlab.com or a self-managed instance) containing the repositories you want to track
Knowledge

1
Find GitLab on the Sentry integrations page

In Sentry, go to Settings → Integrations and find GitLab under Source Code Management. Click into it to open the integration detail page, then click Add Installation. A configuration modal appears with instructions for the GitLab side of the setup — keep this window open, you'll come back to it after creating the app in GitLab. If you don't see an Add Installation button, your Sentry role isn't high enough; you need owner, manager, or admin.

GitLab integration docs

2
Create the Sentry application in GitLab

In GitLab, add a new application either at the group level (Group → Settings → Access → Applications) or user level (User Settings → Access → Applications). Use the group settings if the repositories you plan to connect are owned by a team. You can also register the application instance-wide if you are self-hosting GitLab. Fill in the fields as show in the Sentry modal, then save. GitLab will display an Application ID and a Secret — copy both, you'll paste them into Sentry in the next step. The redirect URI must match Sentry exactly, and Confidential must stay checked.

Return to the Sentry installation modal and click Next. Complete the configuration form with your GitLab details. Paste in the Application ID and Secret you copied from GitLab, then submit. Sentry redirects you to GitLab to authorize the app — approve it to complete the connection.

  • NameSentry
  • Redirect URIhttps://sentry.io/extensions/gitlab/setup/
  • Scopes — check api
  • Confidential — leave checked
  • Expire access tokens — leave checked
GitLab integration setup reference

3
Set up code mappings for stack trace linking

Code mappings tell Sentry how the file paths in your stack traces line up with the files in your GitLab repo, so each frame can link straight to the source. Go to Settings → Integrations → GitLab → Configurations, then navigate to Configure → Code Mappings, and add a mapping for each project: pick the Sentry project, the connected repository, the default branch (usually main or master), and the stack trace root / source code root if your deployed paths differ from your repo layout. Sentry can often suggest mappings automatically once code is connected. With a mapping in place, the Open in GitLab** links appear on stack frames in your issues.

Stack trace linking guide

4
Verify suspect commits and unlock Seer

Setting up this connection lets you open a recent issue in Issues and see Suspect Commits, which names the commit and author that are most likely responsible for the error. It's all powered by the release and commit data GitLab now sends. Stack frames should show Open in GitLab links from the mappings in step 4. Because Seer also reads your connected repositories, it can now run Root Cause Analysis against your actual code and open merge requests with fixes. To send commit data with your releases, associate commits during deploys with sentry-cli releases set-commits.

Suspect commits documentation
A screenshot of a stack trace including GitLab code source.

5
Enable Self-healing with Seer

Now that your project and repository are fully connected, you can set up Seer to handle fixing issues on your behalf. Navigate to the Seer Settings and press + Add Project. Select the project you want to enable Seer for and the corresponding repository. Then choose the automation steps you would like Seer to complete on your behalf. A quick note, currently only Seer's native agent are available for GitLab. Press Save Project.

Note that you can add multiple repositories in case your project is monitoring an application that is spread across multiple code repos.

Seer Autofix documentation

That's it.

Your errors now point at the code.

With GitLab connected, Sentry links stack frames to source, blames the commit that likely caused each issue, and gives Seer the repository access it needs to suggest real fixes.

  • Added the GitLab integration to your Sentry organization
  • Created a GitLab application for Sentry with the correct redirect URI and scopes
  • Linked your GitLab group to Sentry using the Application ID and Secret
  • Connected a repository to a Sentry project
  • Set up code mappings so stack traces link directly to source in GitLab
  • Setup Seer automation to create a plan for issues fixes or open a merge request for you

Pro tips

  • 💡 Create the GitLab OAuth app under a group (or a dedicated service account) rather than a personal user account — if the person who set it up leaves and their account is removed, a personal app breaks the whole integration.
  • 💡 Add every repository that ships code to your Sentry projects. Suspect commits, code mappings, and Seer can only see repos you've explicitly connected in the Configure step.
  • 💡 Let Sentry auto-suggest code mappings first, then only hand-edit the stack trace root and source root when your deployed file paths differ from your repository layout.
  • 💡 Send commit data with your releases (via CI or sentry-cli releases set-commits --auto) so suspect commits have the history they need to blame the right change.

Common pitfalls

  • ⚠️ The redirect URI must be exactly https://sentry.io/extensions/gitlab/setup/. A trailing-slash or http/https mismatch is the most common reason the authorization step fails.
  • ⚠️ Forgetting to check Confidential on the GitLab application will cause the connection to fail — it must stay enabled.
  • ⚠️ The Group Path field expects a group or subgroup, not a project URL. Pointing it at a single project's URL will not work.
  • ⚠️ Suspect commits only appear once commit data is associated with your releases. If the section is empty, your releases aren't sending commits yet — wire up set-commits in your deploy pipeline.

Frequently asked questions

Both. Enter your own domain as the GitLab URL when you fill out the configuration form. For self-managed instances you can register the Sentry application at the group level or instance-wide. The rest of the setup — scopes, redirect URI, and adding repositories — is identical.

You need the owner, manager, or admin role in Sentry to add the integration, and owner or maintainer permissions on the GitLab group to create the OAuth application. Using a dedicated service account on the GitLab side is recommended so the integration doesn't break if an individual's account is removed.

Suspect commits rely on commit data being associated with your releases. Adding the repository is only half of it — your deploys also need to send commits, for example with sentry-cli releases set-commits --auto in CI. Once commits are linked to a release, the Suspect Commits section populates automatically.

Yes. Source code management integrations, including GitLab, are available on all Sentry plans at no additional cost. Seer's AI features have their own usage-based pricing, but connecting GitLab itself is free.

No. Sentry reads file contents on demand to power features like stack trace linking and Seer's analysis, but it does not clone or permanently store your repository. Sentry also does not use your source code to train generative AI models.

Fix it, don't just observe it.

Get started with the only application monitoring platform that empowers developers to fix application problems without compromising on velocity.