Skip to content
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
9 changes: 9 additions & 0 deletions .changeset/orange-impalas-repeat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@opennextjs/aws": patch
---

fix: add early return for downplayed aws-sdk errors

In the logger adapter:

An issue was identified where downplayed errors from the aws-sdk client (f.ex NoSuchKey from S3) would not return from the function early. This caused unnecessary invocation of `console.error` outside the conditional.
5 changes: 3 additions & 2 deletions packages/open-next/src/adapters/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ const isDownplayedErrorLog = (errorLog: AwsSdkClientCommandErrorLog) =>
export function error(...args: any[]) {
// we try to catch errors from the aws-sdk client and downplay some of them
if (args.some((arg) => isDownplayedErrorLog(arg))) {
debug(...args);
} else if (args.some((arg) => isOpenNextError(arg))) {
return debug(...args);
}
if (args.some((arg) => isOpenNextError(arg))) {
// In case of an internal error, we log it with the appropriate log level
const error = args.find((arg) => isOpenNextError(arg))!;
if (error.logLevel < getOpenNextErrorLogLevel()) {
Expand Down
Loading