Skip to content

instaceof with Exceptions is broken. #6771

@sobolk

Description

@sobolk

Checkboxes for prior research

Describe the bug

We (AWS Amplify) got broken by smithy-lang/smithy-typescript#1484 .

This was dectected by our canary workflow here
https://github.com/aws-amplify/amplify-backend/actions/runs/12586737788/job/35081205621 .

Minimal repro:

import { NoSuchKey, S3, S3ServiceException } from '@aws-sdk/client-s3';

const dummyS3ServiceException = new S3ServiceException({
    name: 'TEST_ERROR',
    message: 'TEST_MESSAGE',
    $fault: 'server',
    $metadata: {},
});

console.log(dummyS3ServiceException instanceof NoSuchKey)

Prints

bcd0740fa72c:testapp073 sobkamil$ node index.js
true

The dummy S3ServiceException is not NoSuchKey error !!!

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

"@aws-sdk/client-s3": "^3.721.0"

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v20.18.1

Reproduction Steps

Minimal repro:

import { NoSuchKey, S3, S3ServiceException } from '@aws-sdk/client-s3';

const dummyS3ServiceException = new S3ServiceException({
    name: 'TEST_ERROR',
    message: 'TEST_MESSAGE',
    $fault: 'server',
    $metadata: {},
});

console.log(dummyS3ServiceException instanceof NoSuchKey)

Prints

bcd0740fa72c:testapp073 sobkamil$ node index.js
true

Observed Behavior

Exceptions are misscategorized with instaceof operator

Expected Behavior

console.log(dummyS3ServiceException instanceof NoSuchKey) returns false

Possible Solution

Revert smithy-lang/smithy-typescript#1484

Additional Information/Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.p1This is a high priority issuepending-releaseThis issue will be fixed by an approved PR that hasn't been released yet.potential-regressionMarking this issue as a potential regression to be checked by team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions