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

[Identity] min-max tests failed because of inconsistent types loaded #19862

Merged
merged 1 commit into from
Jan 19, 2022

Conversation

sadasant
Copy link
Contributor

@sadasant sadasant commented Jan 14, 2022

Checklists

  • Added impacted package name to the issue description

Packages impacted by this PR:

@azure/identity

Describe the problem that is addressed by this PR:

Even though we merged an update recently to fix min-max tests, #19810 which we tested using the pipelines against that PR, nightly min-max tests ended up failing right afterwards. The error received was as follows:


node/clientCertificateCredential.spec.ts(93,24): error TS2769: No overload matches this call.
  Overload 1 of 2, '(tenantId: string, clientId: string, certificatePath: string, options?: ClientCertificateCredentialOptions | undefined): ClientCertificateCredential', gave the following error.
    Argument of type '{ certificatePath: string; }' is not assignable to parameter of type 'string'.
  Overload 2 of 2, '(tenantId: string, clientId: string, configuration: ClientCertificateCredentialPEMConfiguration, options?: ClientCertificateCredentialOptions | undefined): ClientCertificateCredential', gave the following error.
    Type '(_request: PipelineRequest) => Promise<PipelineResponse>' is not assignable to type 'SendRequest'.
      Types of parameters '_request' and 'request' are incompatible.
        Type 'import("/mnt/vss/_work/1/s/sdk/core/core-rest-pipeline/types/latest/core-rest-pipeline").PipelineRequest' is not assignable to type 'import("/mnt/vss/_work/1/s/common/temp/node_modules/.pnpm/@azure+core-rest-pipeline@1.4.0/node_modules/@azure/core-rest-pipeline/types/latest/core-rest-pipeline").PipelineRequest'.
          Types of property 'body' are incompatible.
            Type 'import("/mnt/vss/_work/1/s/sdk/core/core-rest-pipeline/types/latest/core-rest-pipeline").RequestBodyType | undefined' is not assignable to type 'import("/mnt/vss/_work/1/s/common/temp/node_modules/.pnpm/@azure+core-rest-pipeline@1.4.0/node_modules/@azure/core-rest-pipeline/types/latest/core-rest-pipeline").RequestBodyType | undefined'.
              Type 'ReadableStream<Uint8Array>' is not assignable to type 'RequestBodyType | undefined'.
                Type 'ReadableStream<Uint8Array>' is missing the following properties from type 'ReadableStream': readable, read, setEncoding, pause, and 22 more.

Having experienced similar issues in the past, I realized that this is likely because there are more than one copy of the same package loaded into TypeScript memory with a small version difference. Even if the types are identical, given that they don’t come from the same place, TypeScript can’t really assume they’re the same — that has been my experience in the past, at least.

So, my strategy was to find the simplest solution by perhaps removing an unnecessary type.

I followed the instructions to run min-max tests locally (here). I reproduced the issue, then I was able to remove an unused parameter to fix it.

@sadasant sadasant self-assigned this Jan 14, 2022
@ghost ghost added the Azure.Identity label Jan 14, 2022
@witemple-msft
Copy link
Member

CC @joheredi @xirzec : This must be related to the whatwg stream and fetch support that was merged into corev2. It does make sense that adding a new variation to the request body type is a breaking change for core consumers.

@sadasant
Copy link
Contributor Author

@witemple-msft keep in mind that this only fails in min-max and not on the rest of the tests (record, playback, live, none of that).

@xirzec
Copy link
Member

xirzec commented Jan 18, 2022

CC @joheredi @xirzec : This must be related to the whatwg stream and fetch support that was merged into corev2. It does make sense that adding a new variation to the request body type is a breaking change for core consumers.

Hmm... doesn't the above error make sense though? If I understand it correctly, it's trying to send a PipelineRequest that supports streams to an older version of core that doesn't support streams, so it fails.

@sadasant
Copy link
Contributor Author

I’ll merge this since this solves our nightly builds and the changes are not negatively impactful in any way.

@sadasant sadasant merged commit 9713c4d into Azure:main Jan 19, 2022
@sadasant sadasant deleted the identity/min-max-bad-types branch January 19, 2022 01:21
ellismg added a commit to ellismg/azure-sdk-for-js that referenced this pull request Jan 28, 2022
Similar to Azure#19862, we have recently started to see some issues in our
nightly min/max jobs that prevent us from saving the entire Response
object during the `onResponse` callback due to multiple imports of the
"same" type.

Similar to the resolution for Azure#19862, I've decided to just not use
nominal types from `core-client` here and instead just stash away the
parts of the response I need inside the callback and observe the
values after.

Fixes Azure#20014
ellismg added a commit that referenced this pull request Jan 29, 2022
Similar to #19862, we have recently started to see some issues in our
nightly min/max jobs that prevent us from saving the entire Response
object during the `onResponse` callback due to multiple imports of the
"same" type.

Similar to the resolution for #19862, I've decided to just not use
nominal types from `core-client` here and instead just stash away the
parts of the response I need inside the callback and observe the
values after.

Fixes #20014
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.

4 participants