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 logs that exceeds Vercel limit #1648

Merged
merged 3 commits into from
Nov 19, 2024
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
5 changes: 5 additions & 0 deletions .changeset/fuzzy-pets-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-avatax": patch
---

Remove not needed information from AvaTax app logs to make them more readable and to be below Vercel log drain limit.
8 changes: 8 additions & 0 deletions .changeset/new-hornets-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@saleor/webhook-utils": patch
"@saleor/apps-logger": patch
"app-avatax": patch
"smtp": patch
---

Update modern-errors-serialize library so it supports excluding error property from serialization
2 changes: 1 addition & 1 deletion apps/avatax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"jotai": "^2.4.2",
"jsdom": "^20.0.3",
"modern-errors": "7.0.1",
"modern-errors-serialize": "6.0.0",
"modern-errors-serialize": "6.1.0",
"neverthrow": "6.2.1",
"next": "14.2.3",
"react": "18.2.0",
Expand Down
3 changes: 3 additions & 0 deletions apps/avatax/src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export type CommonErrorProps = {
export const BaseError = ModernError.subclass("BaseError", {
props: {} as CommonErrorProps,
plugins: [modernErrorsSerialize],
serialize: {
exclude: ["stack"],
},
});

// Critical errors are reported to Sentry.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@ export const extractTransactionRedactedLogProperties = (model: CreateTransaction
companyCode: model.companyCode,
isAutocommit: model.commit,
currencyCode: model.currencyCode,
lines: model.lines.map((line) => ({
amount: line.amount,
taxCode: line.taxCode,
quantity: line.quantity,
itemCode: line.itemCode,
description: line.description,
discounted: line.discounted,
})),
linesCount: model.lines.length,
date: model.date.toISOString(),
isTaxIncluded: model.lines[0]?.taxIncluded ?? false,
discountAmount: model.discount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export class CalculateTaxesUseCase {
});
},
).map((results) => {
this.logger.info("Taxes calculated", { calculatedTaxes: results });
this.logger.info("Taxes calculated - returning response do Saleor");

ClientLogStoreRequest.create({
level: "info",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ const handler = checkoutCalculateTaxesSyncWebhook.createHandler(async (req, res,

subscriptionErrorChecker.checkPayload(payload);

logger.info("Tax base payload for checkout calculate taxes", {
payload: payload.taxBase,
});

loggerContext.set(ObservabilityAttributes.CHANNEL_SLUG, ctx.payload.taxBase.channel.slug);
loggerContext.set(ObservabilityAttributes.CHECKOUT_ID, ctx.payload.taxBase.sourceObject.id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ const handler = orderCalculateTaxesSyncWebhook.createHandler(async (req, res, ct
discountStrategy,
);

// eslint-disable-next-line @saleor/saleor-app/logger-leak
logger.info("Taxes calculated", { calculatedTaxes: JSON.stringify(calculatedTaxes) });
logger.info("Taxes calculated - returning response do Saleor");

ClientLogStoreRequest.create({
level: "info",
Expand Down
2 changes: 1 addition & 1 deletion apps/smtp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"jsdom": "^20.0.3",
"mjml": "4.15.3",
"modern-errors": "7.0.1",
"modern-errors-serialize": "6.0.0",
"modern-errors-serialize": "6.1.0",
"neverthrow": "6.2.1",
"next": "14.2.3",
"nodemailer": "^6.9.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"vite": "5.3.3",
"vitest": "1.6.0",
"modern-errors": "7.0.1",
"modern-errors-serialize": "6.0.0"
"modern-errors-serialize": "6.1.0"
},
"exports": {
".": {
Expand Down
2 changes: 1 addition & 1 deletion packages/webhook-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"graphql": "16.7.1",
"graphql-tag": "2.12.6",
"modern-errors": "7.0.1",
"modern-errors-serialize": "6.0.0",
"modern-errors-serialize": "6.1.0",
"semver": "7.5.1",
"urql": "4.0.4"
},
Expand Down
32 changes: 16 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.