Azurite icon indicating copy to clipboard operation
Azurite copied to clipboard

Bump vsce from 2.15.0 to 2.32.0, switch TS to ESM import when possible

Open commiterate opened this issue 3 months ago • 7 comments

Relates to https://github.com/Azure/Azurite/issues/2601.

vsce migrated to @vscode/vsce starting with 2.16.0.

https://github.com/microsoft/vscode-vsce/commit/03833243782d76dddad9cdc262a5e214b2e7c311

commiterate avatar Oct 07 '25 21:10 commiterate

@microsoft-github-policy-service agree company="NVIDIA"

commiterate avatar Oct 07 '25 21:10 commiterate

Looks like that bumped some other ESLint deps which don't like some of the require("{module}") statements. Need to switch those to the ESM import syntax.

commiterate avatar Oct 09 '25 17:10 commiterate

Moved as many remaining imports using CJS syntax (require("module")) to ESM syntax. The only one I didn't touch is this since I'm not too sure what to do with it:

https://github.com/Azure/Azurite/blob/v3.35.0/src/common/utils/utils.ts#L8-L10

commiterate avatar Oct 09 '25 17:10 commiterate

Hmm npm run test:table is failing for me locally on Ubuntu 24.04 + Node.js 22 due to the CORS tests.

  446 passing (6s)
  1 pending
  4 failing

  1) table Entity APIs test
       Service with mismatching cors rules should response header Vary @loki:

      AssertionError [ERR_ASSERTION]: false == true
      + expected - actual

      -false
      +true
      
      at Context.<anonymous> (tests/table/auth/tableCorsRequest.test.ts:494:12)
      at processTicksAndRejections (node:internal/process/task_queues:105:5)

  2) table Entity APIs test
       Request Match rule exists that allows all origins (*) @loki:

      AssertionError [ERR_ASSERTION]: false == true
      + expected - actual

      -false
      +true
      
      at Context.<anonymous> (tests/table/auth/tableCorsRequest.test.ts:527:12)
      at processTicksAndRejections (node:internal/process/task_queues:105:5)

  3) table Entity APIs test
       Request Match rule exists for exact origin @loki:

      AssertionError [ERR_ASSERTION]: false == true
      + expected - actual

      -false
      +true
      
      at Context.<anonymous> (tests/table/auth/tableCorsRequest.test.ts:564:12)
      at processTicksAndRejections (node:internal/process/task_queues:105:5)

  4) table Entity APIs test
       Request Match rule in sequence @loki:

      AssertionError [ERR_ASSERTION]: false == true
      + expected - actual

      -false
      +true
      
      at Context.<anonymous> (tests/table/auth/tableCorsRequest.test.ts:646:12)
      at processTicksAndRejections (node:internal/process/task_queues:105:5)

Since none of the CORS logic on Azurite's side changed, it seems like the VSCE bump pulling in a newer @azure/core-client is breaking these tests.

commiterate avatar Oct 09 '25 18:10 commiterate

This is also a bit awkward because some of the updated Azure SDK packages now declare Node.js 20 as a minimum, so the Node.js 16 tests will fail. That means we need https://github.com/Azure/Azurite/pull/2568 first to drop Node.js 16.

commiterate avatar Oct 09 '25 18:10 commiterate

It doesn't look like TableServiceClient.getProperties().vary is a valid property in @azure/[email protected] (wasn't updated with the VSCE bump) so apparently something else is adding this in (and probably why the tests cast it to any).

  • https://github.com/Azure/azure-sdk-for-js/blob/%40azure/data-tables_13.2.2/sdk/tables/data-tables/src/TableServiceClient.ts#L214-L223
  • https://github.com/Azure/azure-sdk-for-js/blob/%40azure/data-tables_13.2.2/sdk/tables/data-tables/src/generatedModels.ts#L6
  • https://github.com/Azure/azure-sdk-for-js/blob/%40azure/data-tables_13.2.2/sdk/tables/data-tables/src/generated/models/index.ts#L676-L678
  • https://github.com/Azure/azure-sdk-for-js/blob/%40azure/data-tables_13.2.2/sdk/tables/data-tables/src/generated/models/index.ts#L391-L399
  • https://github.com/Azure/azure-sdk-for-js/blob/%40azure/data-tables_13.2.2/sdk/tables/data-tables/src/generated/models/index.ts#L85-L95

commiterate avatar Oct 09 '25 19:10 commiterate

It's this commit for @azure/core-client which strips unknown headers from responses when deserializing.

https://github.com/Azure/azure-sdk-for-js/commit/5e0ed691e42b0249bb9e9066a2345db571a4fe99

It's first included in the @azure/core-client_1.7.1 Git tag for the various @azure/core-client_{version} Git tags.

Since bumping VSCE to 2.32.0 also bumps @azure/core-client from 1.5.0 to 1.10.1, the Vary header these CORS tests check for no longer exists since it's being stripped out by the deserializer.

Switching the operation options to stop ignoring unknown properties doesn't help either.

serviceClientWithOrigin.getProperties({
    serializerOptions: {
        ignoreUnknownProperties: false,
        xml: {}
    }
})

@blueww @EmmaZhu Am I good to remove these 4 CORS unit tests?

commiterate avatar Oct 09 '25 19:10 commiterate