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

fix(types): fix webhooks config types #154

Merged
merged 6 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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