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

AbortSignal type doesn't conform to WHATWG API #1159

Closed
aquark opened this issue May 8, 2020 · 1 comment · Fixed by #1699
Closed

AbortSignal type doesn't conform to WHATWG API #1159

aquark opened this issue May 8, 2020 · 1 comment · Fixed by #1699
Assignees
Labels
High Priority needs-triage This issue or PR still needs to be triaged.

Comments

@aquark
Copy link

aquark commented May 8, 2020

Describe the bug
When I attempt to pass an AbortSignal created using the browser's native AbortController to an SDK client, I get a type error:

Argument of type 'AbortSignal' is not assignable to parameter of type 'import("/Volumes/Brazil/IhmCartwheel/src/IhmCartwheel/image/node_modules/.pnpm/amazon.goshawk.aws.a2z.com/@aws-sdk/types/1.0.0-beta.4/node_modules/@aws-sdk/types/build/abort").AbortSignal'.
  Types of property 'onabort' are incompatible.
    Type '((this: AbortSignal, ev: Event) => any) | null' is not assignable to type 'AbortHandler | undefined'.
      Type 'null' is not assignable to type 'AbortHandler | undefined'.ts(2345)

This also prevents using the NodeJS abort-controller package. The WHATWG spec for this API requires that the handler defaults to null, not undefined.

I don't want to use @aws-sdk/abort-controller because I have some library functions which need to interoperate with both the SDK and other AbortSignal consumers using the DOM implementation.

SDK version number 1.0.0-beta.4

Is the issue in the browser/Node.js? Both

Details of the browser/Node.js version N/A

To Reproduce (observed behavior)

import { LambdaClient, InvokeCommand } from "@aws-sdk/client-lambda";

const abortSignal = new AbortController().signal;
const client = new LambdaClient({});

client.send(
  new InvokeCommand({
    FunctionName: "GetTermsAndConditions",
    InvocationType: "RequestResponse",
  }),
  { abortSignal }
);

Expected behavior
Should pass type check

Screenshots
N/A

Additional context
Add any other context about the problem here.

@AllanZhengYP AllanZhengYP added the needs-triage This issue or PR still needs to be triaged. label May 8, 2020
@alexforsyth alexforsyth added this to Awaiting Triage in High Priority Nov 12, 2020
@trivikr trivikr assigned trivikr and unassigned alexforsyth Nov 19, 2020
High Priority automation moved this from Awaiting Triage to Done Nov 19, 2020
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
High Priority needs-triage This issue or PR still needs to be triaged.
Projects
Development

Successfully merging a pull request may close this issue.

4 participants