Skip to content

Commit

Permalink
fix(types): fix webhooks config types (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
good-idea authored Mar 17, 2021
1 parent 2d7c982 commit c71a230
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ This plugin does not manage orders or customer carts. You will need to use Shopi

# Alpha Changelog

### 0.20.0

The config for `@sane-shopify/server` has changed. `onError` is now part of the main config object. Instead of `createWebhooks({ config, onError })`, do `createWebhooks(config)`. See the [`@sane-shopify/server` Readme](packages/server/README.md)

Source data now includes shopify media. Thanks @liqueflies for adding this!

### 0.11.0

`@sane-shopify/server` now exports functions that can be used to handle Shopify's webhooks.
Expand Down
19 changes: 13 additions & 6 deletions packages/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ if (!authToken) throw new Error('You must provide a sanity auth token')
if (!shopName) throw new Error('You must provide a shopify shop name')
if (!accessToken) throw new Error('You must provide a shopify access token')


// optional, see below
const handleError = (err: Error) => {
Sentry.captureException(err)
}


// 🚨 Alpha breaking change: This configuration changed in 0.20.0. If you are getting errors after updating, put your `onError` handler on the `config` object, and pass that object into `createWebhooks` as the sole argument.

const config = {
secrets: {
sanity: {
Expand All @@ -57,16 +66,14 @@ const config = {
accessToken,
},
},
onError: handleError
}

// optional, see below
const onError = Sentry.captureException(error)

export const webhooks = createNextWebhooks({ config, onError })
export const webhooks = createNextWebhooks(config)
// or
// export const webhooks = createAWSWebhooks({ config, onError })
// export const webhooks = createAWSWebhooks(config)
// or
// export const webhooks = createWebhooks({ config, onError })
// export const webhooks = createWebhooks(config)
```

### Error Handling
Expand Down

0 comments on commit c71a230

Please sign in to comment.