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

OpsGenie integration does not work when created via API. #59517

Open
rodolfoBee opened this issue Nov 7, 2023 · 9 comments
Open

OpsGenie integration does not work when created via API. #59517

rodolfoBee opened this issue Nov 7, 2023 · 9 comments

Comments

@rodolfoBee
Copy link
Member

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

  1. Have a sentry and opsgenie account
  2. Create a Sentry integration key in OpsGenie using the opsgenie api https://docs.opsgenie.com/docs/integration-api#create-api-based-integration
  3. Configure the OpsGenie integration in Sentry using the API key created in step2
  4. Create an alert rule to send messages to opsgenie.

Expected Result

The integration in Sentry works and alerts messages are sent to opsenie when a rule is triggered.

Actual Result

No alert messages are sent.

Issue was initially raised in: pulumi/pulumi-opsgenie#203
Manually creating the integration in OpsGenie serves as a workaround, however there is not explanation at the moment on why the API-generated key does not.

@Dhrumil-Sentry mentions the user needs to created the integration via the UI. Is this a requirement? Is there an explanation on why this is the case?

Product Area

Settings - Integrations

Link

No response

DSN

No response

Version

No response

@getsantry
Copy link
Contributor

getsantry bot commented Nov 7, 2023

Assigning to @getsentry/support for routing ⏲️

@getsantry
Copy link
Contributor

getsantry bot commented Nov 7, 2023

Routing to @getsentry/product-owners-settings-integrations for triage ⏲️

@Dhrumil-Sentry
Copy link

Adding this to the backlog for investigating

@m1n9o
Copy link

m1n9o commented Nov 20, 2023

Any progress on this?
I tried it again, but it's still not working.

{
  "type": "Sentry",
  "name": "SentryIntegrationAPI",
  "ownerTeam": {
    	"name": "[TEAM NAME]"
    },
  "allowReadAccess" : true,
	"allowWriteAccess" : true,
	"allowDeleteAccess" : false,
	"allowConfigurationAccess" : true,
  "ignoreRespondersFromPayload": false,
  "ignoreTeamsFromPayload": false,
  "suppressNotifications": false
}

This is the body I used to create the integration.

And this is the way I generate the exception.

import sentry_sdk
import random

sentry_sdk.init(
    dsn="YOUR DSN",
    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for performance monitoring.
    traces_sample_rate=1.0,
)


def run():
    num = random.randint(5, 9)
    if num > 5:
        raise AttributeError
    if num < 5:
        raise BufferError


if __name__ == "__main__":
    run()

@Dhrumil-Sentry
Copy link

Hi @m1n9o we don't have an update for this yet, it's in our backlog for investigation, is there any reason why you can't just create the integration in the Opsgenie app and use that key itself?

@m1n9o
Copy link

m1n9o commented Nov 22, 2023

Hi @m1n9o we don't have an update for this yet, it's in our backlog for investigation, is there any reason why you can't just create the integration in the Opsgenie app and use that key itself?

Since Click-ops is not encouraged in our company. So we are going to design an internal platform to provision OpsGenie (and Sentry) resources with IaC (maybe pulumi/terraform/api). For our long term goal, this is important.

@martendeng
Copy link

martendeng commented Jun 25, 2024

Are there any updates on this issue? We are currently facing the same thing.

To provide some extra information on our findings. Up until now we were using the legacy Opsgenie integration which seems to support communicating via integrations created using the Opsgenie API. Did something change where the current integration is doing some additional checks?

Additionally it seems like the Opsgenie Integration when created using the parameter allowConfigurationAccess = true actually fixes this issue. See here: pulumi/pulumi-opsgenie#203 (comment). Though it would be better to have this integration work out of the box. I'm wondering if Sentry is trying to access some data that it might not always have permission to?

@mifu67
Copy link
Contributor

mifu67 commented Jul 9, 2024

Any progress on this? I tried it again, but it's still not working.

{
  "type": "Sentry",
  "name": "SentryIntegrationAPI",
  "ownerTeam": {
    	"name": "[TEAM NAME]"
    },
  "allowReadAccess" : true,
	"allowWriteAccess" : true,
	"allowDeleteAccess" : false,
	"allowConfigurationAccess" : true,
  "ignoreRespondersFromPayload": false,
  "ignoreTeamsFromPayload": false,
  "suppressNotifications": false
}

This is the body I used to create the integration.

Hi @m1n9o and @martendeng,

I tried the code provided above, and it works for me. After investigating, it seems that allowConfigurationAccess must be set to true because the Opsgenie API requires that keys have configuration access to hit the authentication endpoint (https://api.opsgenie.com/v2/integrations/authenticate). We hit this endpoint before creating a new rule that sends Opsgenie notifications in order to verify that the keys are valid.

@d-lee-raimondi
Copy link

d-lee-raimondi commented Sep 21, 2024

I am creating the integration manually in the UI as described in https://docs.sentry.io/organization/integrations/notification-incidents/opsgenie/ and https://support.atlassian.com/jira-service-management-cloud/docs/integrate-with-sentry/ and I am getting the error initially reported in pulumi/pulumi-opsgenie#203.

I contacted Sentry support and they directed me to this GitHub issue (Case 132930). Is there a way to fix it or at least get more debug info? It appears this is the place in the code where the exception is thrown

elif team_status == INVALID_KEY:

Atlassian insists that hey key looks good to them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Waiting for: Product Owner
Development

No branches or pull requests

8 participants