Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

compass api error: CREATE_EVENT_SOURCE_NOT_FOUND

Phill Pafford August 2, 2023

Following the guide here on how to setup compass api events

Created two events, `CUSTOM` and `DEPLOYMENT`  using the GraphQL process

example rest api request script

#!/usr/bin/env bash

set -e

COMPASS_CLOUD_INSTANCE=my-company
COMPASS_REST_API_VERSION=v1
COMPASS_USER_EMAIL=user@email.com
COMPASS_USER_TOKEN=myLongTokenBlahBlahBalh
COMPASS_BASE_URL="https://$COMPASS_CLOUD_INSTANCE.atlassian.net/gateway/api/compass/$COMPASS_REST_API_VERSION/events"

## NOTE: need to create the metric in the UI first, example: https://my-company.atlassian.net/compass/component/asdasdasdasdas-sdsd-sdsd-sdsd-asdasdasdasdsad
COMPASS_CLOUD_ID="aaaaaaaaaa-bbbb-1111-2222-ccccccccccccccc"

TIMESTAMP=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
COMPASS_CUSTOM_DISPLAY_NAME="display name"
COMPASS_CUSTOM_UPDATE_SEQUENCE_NUMBER=215
COMPASS_CUSTOM_DESCRIPTION="display description"
COMPASS_CUSTOM_URL="https://example.com"
## using ari from GraphQL response in setup steps
COMPASS_CUSTOM_EXTERNAL_EVENT_SOURCE_ID="ari:cloud:compass:long-string:event-source/another-long-string/yet-another-long-string"
COMPASS_CUSTOM_CUSTOM_EVENT_PROPERTIES_ID=1
COMPASS_CUSTOM_CUSTOM_EVENT_PROPERTIES_ICON=INFO

## data needs to be JSON, use JQ for this
COMPASS_EVENT_JSON_DATA=$( jq -n \
--arg cloudId "$COMPASS_CLOUD_ID" \
--arg cDisplayName "$COMPASS_CUSTOM_DISPLAY_NAME" \
--arg cLastUpdated "$TIMESTAMP" \
--argjson cUpdateSequenceNumber $COMPASS_CUSTOM_UPDATE_SEQUENCE_NUMBER \
--arg cDescription "$COMPASS_CUSTOM_DESCRIPTION" \
--arg cUrl "$COMPASS_CUSTOM_URL" \
--arg cExternalEventSourceId "$COMPASS_CUSTOM_EXTERNAL_EVENT_SOURCE_ID" \
--arg cCustomEventPropertiesId "$COMPASS_CUSTOM_CUSTOM_EVENT_PROPERTIES_ID" \
--arg cCustomEventPropertiesIcon "$COMPASS_CUSTOM_CUSTOM_EVENT_PROPERTIES_ICON" \
'{cloudId: $cloudId, event: {custom: {displayName: $cDisplayName, lastUpdated: $cLastUpdated, updateSequenceNumber: $cUpdateSequenceNumber, description: $cDescription, url: $cUrl, externalEventSourceId: $cExternalEventSourceId, customEventProperties: {id: $cCustomEventPropertiesId, icon: $cCustomEventPropertiesIcon}}}}'
)

echo "DEBUG: "
echo $COMPASS_EVENT_JSON_DATA
echo ""

COMPASS_EVENT=`curl --request POST \
--url $COMPASS_BASE_URL \
--user $COMPASS_USER_EMAIL:$COMPASS_USER_TOKEN \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data "$COMPASS_EVENT_JSON_DATA"`

echo "COMPASS_EVENT: $COMPASS_EVENT"

response

{
"errors": [
{
"type": "CREATE_EVENT_SOURCE_NOT_FOUND",
"message": "We could not create the event because the event source is not found. Please check that the external event source ID and the type of event being submitted match the event source.If a Forge App ID was used during event source creation, please also check you are using the same Forge App ID when accessing the event source."
}
]
}

1 answer

1 accepted

2 votes
Answer accepted
Phill Pafford August 2, 2023

SOLVED: when creating the event types in GraphQL, the name of X is what should be used and not the ARI of the event

{ "input": { "cloudId": "<your cloud ID>", "externalEventSourceId": "<external event source ID>", "eventType": "CUSTOM" } }

example

COMPASS_CUSTOM_EXTERNAL_EVENT_SOURCE_ID="what ever unique name you give it"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events