address for this topic has already been taken

address for this topic has already been taken

oozdemir
Visitor
2 0 0

Webhook (EventBridge) creation through Admin API fails with error message:

 

 

{
    "errors": {
        "address": [
            "for this topic has already been taken"
        ]
    }
}

 

 

I fetch currently existing webhooks and cannot find a webhook that is using the same address and same topic. I have no webhooks created through Shopify Admin. None. I have checked multiple times. Is there a limit on how many webhooks can subscribe to the same topic for a given shop? What am I doing wrong? I don't think there is a coding error because when I change the EventSource to a different one on the same shop and app, same code works without any issues. Please help.

 

 

      const data = JSON.stringify({
        webhook: {
          topic 'customers/create',
          address: eventBridgeAddress,
          format: 'json',
        },
      });

      const config = {
        method: 'post',
        url: `https://${STORE_NAME}.myshopify.com/admin/api/2021-10/webhooks.json`,
        headers: {
          'X-Shopify-Access-Token': ACCESS_TOKEN,
          'Content-Type': 'application/json',
        },
        data,
      } as AxiosRequestConfig;

      try {
        await axios(config);
      } catch (error) {
        console.log(JSON.stringify(error));
      }

 

 

Replies 8 (8)

mikedasilva
Shopify Staff (Retired)
61 7 13

Hi,

 

Please DM the details you are trying to use (eventBridgeAddress and STORE_NAME) so we can provide assistance to why you're getting that response.

 

Cheers,

Mike

To learn more visit the Shopify Help Center or the Community Blog.

oozdemir
Visitor
2 0 0

Hello @mikedasilva , I have sent a message with the info you asked but haven't heard from you guys yet. Can you provide an update on this issue please?

Thanks.

mikedasilva
Shopify Staff (Retired)
61 7 13

Hi,

 

You'll receive that error when you already have a subscription with the same shop & topic & address combination. You can call the API to list the webhook subscriptions you currently have so that you can see what already exists and then update or delete the ones you no longer wish to have.

 

Cheers,

 

To learn more visit the Shopify Help Center or the Community Blog.

yc01
Shopify Partner
2 0 1

Hi

Is there a bug in Shopify because I created an orders/create topic manually and then deleted it. Then I am trying to use the API to create it but it is returning the same 422 error

 

resulted in a `422 Unprocessable Entity` response:

{"errors":{"address":["for this topic has already been taken"]}}

yc01
Shopify Partner
2 0 1

Ok I found the issue in case it helps someone else. If you create the webhook through the API, it does not show up in the "Notifications" tab under your account settings where you can manually create webhooks. But it exists in the backend and can be queried using the webhooks API. I don't know if this is by design but definitely confused me. 

YaBoi
Shopify Partner
3 1 1

I'd like to add that webhooks created with graphQL query (from some external server) won't be accessible in Shopify GraphiQL App, too (and vice versa). Which confused me as well.

mikedasilva
Shopify Staff (Retired)
61 7 13

@YaBoi 

Yes, that's by design. Those webhook subscriptions are available within the context of the app that created them only. The GraphiQL App will only be able to manage subscriptions within its own context and that's why you won't see those when querying using another app.

To learn more visit the Shopify Help Center or the Community Blog.

scottyweeks
Shopify Partner
6 0 2

Seems like something you should mention in the documentation, doesn't it. While it makes all the sense in the world when you explain it that way, my first instinct was to use the Graphiql app as a console for debugging and it was pretty confusing to find this out the hard way.