PagerDuty
Register a PagerDuty OAuth app in the UI, or set it with deployment environment variables, for self-hosted ctxpipe.
Overview
Self-hosted PagerDuty uses the same connector flow as hosted ctxpipe. Someone must still create a Scoped OAuth application in the PagerDuty developer portal. The usual path is to paste the client ID and secret of that app in the connector wizard. ctxpipe then creates one v3 webhook subscription for each connection. Operators do not paste a shared webhook signing secret.
Deployment environment variables (PAGERDUTY_CLIENT_ID /
PAGERDUTY_CLIENT_SECRET) are an optional shortcut, as on hosted ctxpipe. You do not need to restart Compose, Railway,
or CDK to finish first-time setup.
What you need
- A public HTTPS
AUTH_BASE_URL. In production, keepCTXPIPE_PUBLIC_APP_URLon the same origin. - Permission to create a PagerDuty OAuth application.
- A ctxpipe GitHub App connection with write access to each Workspace repository that syncs PagerDuty incidents.
- Network access from the backend and the worker to
identity.pagerduty.comandapi.pagerduty.comorapi.eu.pagerduty.comover HTTPS.
PagerDuty cannot deliver webhooks to a private localhost address. To test a connector end to end, use a public HTTPS deployment or tunnel.
1. Register the OAuth app in the wizard
- Open Connectors, select Add connection, then select Connect on the PagerDuty row. ctxpipe creates a draft connection so that you can save the app before account authorization.
- Open PagerDuty App Registration,
select New App. Name the app
ctxpipeor use the name of your deployment. - Under Functionality, select OAuth 2.0. Leave Events Integration unselected. ctxpipe creates a v3 webhook subscription through PagerDuty's API after account authorization. This is not an Events API integration.
- Choose Scoped OAuth. Register this redirect URL exactly. The wizard copies it for you:
{AUTH_BASE_URL}/api/v1/integrations/pagerduty/callback- Grant only these permission scopes:
incidents.readservices.readusers.readwebhook_subscriptions.readwebhook_subscriptions.write
- Select Register App. Copy the generated client id and client secret before you close the confirmation. PagerDuty shows the secret only once.
- Save both values in Register PagerDuty OAuth app. ctxpipe encrypts the secret on the connection. It never returns the secret from connector metadata. Continue to Connect PagerDuty.
Do not add write-back scopes for incidents. ctxpipe does not acknowledge or resolve PagerDuty incidents.
No PAGERDUTY_WEBHOOK_SECRET
ctxpipe creates webhook signing secrets for each subscription and stores them encrypted on the connection. Do not create a deployment-wide PagerDuty webhook secret.
2. Optional: deployment env shortcut
If you want one shared app for the whole deployment, set
PAGERDUTY_CLIENT_ID and PAGERDUTY_CLIENT_SECRET on the backend and
the worker. Set PAGERDUTY_REDIRECT_URI only when the public callback
differs from the URL that ctxpipe derives from AUTH_BASE_URL. The wizard then starts at
Connect PagerDuty.
ctxpipe looks for credentials in the saved connection app first. Then it looks in the environment variables. The worker needs the client secret that the refresh path reads.
Docker Compose
Add the values to the root .env, then restart the backend and the worker:
PAGERDUTY_CLIENT_ID=...
PAGERDUTY_CLIENT_SECRET=...
pnpm startRailway
Set the OAuth variables on the production backend and worker. The repository's
Terraform module passes provided PAGERDUTY_* values to both services. For
the root Terraform stack, the corresponding inputs are
TF_VAR_pagerduty_client_id, TF_VAR_pagerduty_client_secret, and
TF_VAR_pagerduty_redirect_uri.
AWS CDK
Pass the values through connectorSecrets:
new CtxPipe(stack, "CtxPipe", {
// other required settings
connectorSecrets: {
pagerdutyClientId: cdk.SecretValue.secretsManager("pagerduty/client-id"),
pagerdutyClientSecret: cdk.SecretValue.secretsManager(
"pagerduty/client-secret",
),
// Optional when AUTH_BASE_URL already produces the registered callback:
pagerdutyRedirectUri: cdk.SecretValue.unsafePlainText(
"https://app.example.com/api/v1/integrations/pagerduty/callback",
),
},
});The construct stores these values in the connector secret and injects them into backend and worker task definitions.
3. Public webhook URL
After a user completes OAuth, ctxpipe creates one account-level v3 webhook subscription for incident events and points it at:
{AUTH_BASE_URL}/api/v1/webhook/pagerdutyDo not paste this URL into Events Integration during App Registration. PagerDuty receives it when ctxpipe creates the webhook subscription through the Webhook Subscriptions API.
ctxpipe verifies X-PagerDuty-Signature HMAC-SHA256 against the raw request
body. It binds the event to the one connection whose stored secret verifies. It
routes with X-PagerDuty-Subscription. Re-authorization replaces a lost
secret instead of stacking another subscription on the same event URL.
Account-level delivery can include every service. ctxpipe syncs an event only
for the Workspace sources whose services include the incident's service.
ctxpipe acknowledges events with no service, or with a service that no source
selects, with 200. It never fetches them.
4. Verify the connector
- Confirm
GET /.statussucceeds on the public backend origin. - Open Connectors, select Add connection, then select Connect on the PagerDuty row.
- If the wizard shows Register PagerDuty OAuth app, save the client id and secret. Skip this when the deployment already has a shared app that environment variables set.
- Complete OAuth and confirm the expected account appears.
- In Add PagerDuty to Workspaces, select one or more Workspaces and at least one service for each. Use search. Show more services if the account has many.
- Merge the pull request that adds
sources/pagerduty/<name>.mdin each Workspace repository. - Confirm the source shows Connected in the Workspace settings and generated
files appear under
pagerduty/services/<serviceId>/incidents/. - Trigger or update an in-scope incident and confirm
POST /api/v1/webhook/pagerdutysucceeds and the corresponding Git file changes. - Confirm the Workspace re-indexes.
Upgrade from pagerduty/config.yaml
Earlier versions kept the service scope in pagerduty/config.yaml in one sync
repository. Upgrade step 1 of each Workspace moves the connection to Workspace
sources. An org owner or admin starts it with Start in the
Upgrades section of the Workspace settings. You can also start it from the
command line:
pnpm --filter @ctxpipe/backend migrate-workspace-sources --org <orgId>
pnpm --filter @ctxpipe/backend migrate-workspace-sources --org <orgId> --applyThe first command only prints the plan. With --apply, the command starts
the Workspace upgrade, as the button does. The upgrade opens one pull request
for each Workspace and never pushes to the default branch. When the Workspace
links the old sync repository, the pull request adds the merged services as a
source. The old per-connection sync stops after the merge, when the new source
syncs. When the Workspace repository is the old sync repository, the same pull
request moves each file in pagerduty/incidents/ to
pagerduty/services/<serviceId>/incidents/, with its assets. The service id
comes from the service_id front matter of the file. Git keeps the history of
each moved file. A file without a readable service_id stays in
pagerduty/incidents/.
US and EU accounts
ctxpipe finds the account region from the authorized user's html_url
after OAuth. Do not add a region field to the wizard. The API host is
api.pagerduty.com or api.eu.pagerduty.com.
Troubleshooting
“PagerDuty OAuth is not configured”
Neither the connection nor the deployment has OAuth client credentials. Finish
Register PagerDuty OAuth app in the wizard, or set both
PAGERDUTY_CLIENT_ID and PAGERDUTY_CLIENT_SECRET on the backend and the
worker and restart. The catalog still opens the setup wizard. Connect fails when
ctxpipe cannot create the authorization URL.
Callback is rejected
The registered redirect URI must match
{AUTH_BASE_URL}/api/v1/integrations/pagerduty/callback or
PAGERDUTY_REDIRECT_URI exactly, including scheme, host, path, and whether a
trailing slash is present.
Incremental events never arrive
Confirm these three points: the public webhook URL is reachable, the connection
is connected, and the service of the incident is in a Connected PagerDuty source
of a Workspace. ctxpipe rejects tampered or stale signatures. A failed enqueue
returns 5xx, so PagerDuty can retry.
A source shows “Out of access”
Someone deleted a selected service in PagerDuty, or the OAuth grant cannot read it. ctxpipe tries the service in three sync cycles and keeps its files. Then it marks only that source. Remove the service from the source, or give the connection access to it.
See PagerDuty connector for scope, files, and product troubleshooting.