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

Initially disable Segment app webhooks #1678

Merged
merged 5 commits into from
Jan 9, 2025

Conversation

krzysztofzuraw
Copy link
Member

Scope of the PR

  • After this change webhooks in Segment app will be by default disabled. After configuration is successfully set app will enable webhooks.
    CleanShot 2025-01-09 at 12 28 51@2x

Related issues

Checklist

@krzysztofzuraw krzysztofzuraw requested a review from a team as a code owner January 9, 2025 11:29
@krzysztofzuraw krzysztofzuraw requested review from a team and Cloud11PL January 9, 2025 11:29
Copy link

vercel bot commented Jan 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
saleor-app-segment ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 9, 2025 0:10am
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
saleor-app-avatax ⬜️ Skipped (Inspect) 💬 Add feedback Jan 9, 2025 0:10am
saleor-app-cms ⬜️ Skipped (Inspect) 💬 Add feedback Jan 9, 2025 0:10am
saleor-app-klaviyo ⬜️ Skipped (Inspect) Jan 9, 2025 0:10am
saleor-app-products-feed ⬜️ Skipped (Inspect) 💬 Add feedback Jan 9, 2025 0:10am
saleor-app-search ⬜️ Skipped (Inspect) 💬 Add feedback Jan 9, 2025 0:10am
saleor-app-smtp ⬜️ Skipped (Inspect) 💬 Add feedback Jan 9, 2025 0:10am

export const WebhookStatus = () => {
const { data: config, isLoading, refetch } = trpcClient.configuration.getWebhookConfig.useQuery();

console.log(config);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: leftover console.log :)

Suggested change
console.log(config);

Comment on lines 83 to 87
try {
await service.enableAppWebhooks();
} catch (e) {
expect(e).toBeInstanceOf(WebhookActivityService.WebhookActivityServiceWebhooksError);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: didn't this work?

await expect(service.enableAppWebhooks).throws.toBeInstanceOf(...);

If for some reason it doesn't and we need try...catch then maybe let's also add expect in the try {} block so that we know if test failed (otherwise it will silently pass)

try {
  await service.enableAppWebhooks();
  expect(false); // this shouldn't be called since exception will be thrown
} catch (e)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is leftover from previous implementation - now enableAppWebhooks will return err | ok from neverthrow - I will update the tests

Comment on lines +56 to +60
const appWebhooksEnableResult = Result.combine(
await Promise.all(
webhooksResult.value.map((webhook) => this.client.enableSingleWebhook(webhook.id)),
),
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: maybe we can make feature request to Saleor API so that we have a mutation to update multiple webhooks at the same time?

If one of these updates fails we will have partial state when some webhooks are enabled and some are not :/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - I will create issue for that 👍🏻

Copy link

changeset-bot bot commented Jan 9, 2025

🦋 Changeset detected

Latest commit: 3d0b885

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
segment Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel vercel bot temporarily deployed to Preview – saleor-app-search January 9, 2025 12:08 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-klaviyo January 9, 2025 12:08 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-smtp January 9, 2025 12:08 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-cms January 9, 2025 12:08 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-products-feed January 9, 2025 12:08 Inactive
@vercel vercel bot temporarily deployed to Preview – saleor-app-avatax January 9, 2025 12:08 Inactive
@krzysztofzuraw krzysztofzuraw merged commit b4196e7 into canary Jan 9, 2025
17 checks passed
@krzysztofzuraw krzysztofzuraw deleted the shopx-1785-disable-webhooks-initally-1 branch January 9, 2025 12:34
lkostrowski added a commit that referenced this pull request Jan 13, 2025
* log suspicious taxes calculation (#1658)

* fix log (#1660)

* Use vercel log drain in merchant apps (#1657)

* Use vercel log drain

* Add changeset

* improve log for non zero line (#1663)

* Bring back Segment app to monorepo (#1665)

* Fix deployment of Segment app (#1666)

* Add setup node to GHA workflow (#1673)

* Add Sentry to Segment app (#1671)

* Add OTEL & improve logs in Segment app (#1675)

* Fixed app version send to Segment & how we send events (#1676)

* Add use-case to Segment app (#1677)

* Initially disable Segment app webhooks (#1678)

* Add README to Segment app (#1683)

* Improve Segment app logo (#1682)

* Fix missing cache for test workflow (#1685)

* Add new Vercel log limit (#1684)

* Run autofix for monorepo (#1681)

* Fix code scan issue with ALLOWED_DOMAIN_PATTERN regex (#1687)

---------

Co-authored-by: Lukasz Ostrowski <[email protected]>
Co-authored-by: Paweł Chyła <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants