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

@azure/core-rest-pipeline accidentally broken for Node.js 14 after latest release #28918

Closed
1 task done
apendua opened this issue Mar 14, 2024 · 13 comments
Closed
1 task done
Assignees
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@apendua
Copy link

apendua commented Mar 14, 2024

  • Offending commit: bd7de1d
  • Package Name: @azure/core-rest-pipeline, but potentially other packages modified in the above commit can be affected
  • Package Version: 1.9.1
  • Operating system:
  • nodejs
    • 14.21.3

Describe the bug
Attempting to import SDK results in an exception caused by syntax that's not supported in node 14:

SyntaxError: Unexpected token '??='

To Reproduce

npm i @azure/core-rest-pipeline

Then run the following trivial script:

// index.js
require('')

to get the following error:

/[...]/node_modules/@azure/core-rest-pipeline/dist/commonjs/policies/multipartPolicy.js:99
            boundary ??= parsedBoundary;
                     ^^^

SyntaxError: Unexpected token '??='

Expected behavior
Since previous version of the package did support node 14, the new version should either stay backwards compatible or be published as a major release.

Additional context
I ended up here by debugging a problem with rush utility which used to work for me until yesterday and now it suddenly broke because of the reason explained above. Even though @rushstack/rush-azure-storage-build-cache-plugin is actually careful enough to only require patch updates from @azure/identity:

https://github.com/microsoft/rushstack/blob/main/rush-plugins/rush-azure-storage-build-cache-plugin/package.json#L21C1-L21C33

  "dependencies": {
    "@azure/identity": "~4.0.0",
    ...
  },

this doesn't help in this case since @azure/identity is more permissive:

https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/package.json#L108

  "dependencies": {
    "@azure/abort-controller": "^1.0.0",
    "@azure/core-auth": "^1.5.0",
    "@azure/core-client": "^1.4.0",
    "@azure/core-rest-pipeline": "^1.1.0",
    // ...
  },

A possible solution for this would be to publish a patch for @azure/core-rest-pipeline with the syntax reverted to a more compatible version.

@github-actions github-actions bot added Azure.Core Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Mar 14, 2024
Copy link

Copy link

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@mardimit1
Copy link

Can someone resolve this quickly please?

@maorleger
Copy link
Member

Hey @apendua , thank you for reaching out and creating an issue for this.

I'm sorry to hear about the disruption, agree that can be frustrating.

Node 14 has been deprecated for 2.5 years and has reached its end-of-life roughly 1 year ago. Quoting our support policy:

The Azure SDK libraries for JavaScript will not be guaranteed to work on Node.js versions that have reached their end of life. Dropping support for such Node.js versions may be done without increasing the major version of the Azure SDK libraries.

I strongly recommend moving to a supported Node version to avoid incompatibilities, security concerns, and other painful surprises.

In the future, I may suggest the following options:

  1. Respecting engine incompatibility warnings to avoid surprises.
  2. Our client libraries could continue to work with previous versions of our core libraries as long as they are within the semver range the client library specifies. In that case, a lockfile could have prevented surprises here. Consider using lockfiles to avoid surprise dependency upgrades and give you time to upgrade.
  3. Finally, as a last resort, you could pin your version of @azure/core-rest-pipeline (or any core package) by installing it directly. In this case, npm install --save @azure/[email protected] should pin your version of core-rest-pipeline to a prior version. I strongly recommend against this approach for security reasons, but it is an option to get you unblocked.

Feel free to reach out if you have any other questions, comments, or concerns!

@scottdhicks
Copy link

Hey @apendua , thank you for reaching out and creating an issue for this.

I'm sorry to hear about the disruption, agree that can be frustrating.

Node 14 has been deprecated for 2.5 years and has reached its end-of-life roughly 1 year ago. Quoting our support policy:

The Azure SDK libraries for JavaScript will not be guaranteed to work on Node.js versions that have reached their end of life. Dropping support for such Node.js versions may be done without increasing the major version of the Azure SDK libraries.

I strongly recommend moving to a supported Node version to avoid incompatibilities, security concerns, and other painful surprises.

In the future, I may suggest the following options:

  1. Respecting engine incompatibility warnings to avoid surprises.
  2. Our client libraries could continue to work with previous versions of our core libraries as long as they are within the semver range the client library specifies. In that case, a lockfile could have prevented surprises here. Consider using lockfiles to avoid surprise dependency upgrades and give you time to upgrade.
  3. Finally, as a last resort, you could pin your version of @azure/core-rest-pipeline (or any core package) by installing it directly. In this case, npm install --save @azure/[email protected] should pin your version of core-rest-pipeline to a prior version. I strongly recommend against this approach for security reasons, but it is an option to get you unblocked.

Feel free to reach out if you have any other questions, comments, or concerns!

or just major bump the suite when deprecating support for something? this was a minor bump

@mardimit1
Copy link

A dirty fix to this issue:
npm install --save @azure/[email protected] @azure/[email protected]
After installing all your modules.

@iswarrawat
Copy link

iswarrawat commented Mar 22, 2024

  • Offending commit: bd7de1d

    • Package Name: @azure/core-rest-pipeline, but potentially other packages modified in the above commit can be affected

    • Package Version: 1.9.1

    • Operating system:

    • nodejs

      • 14.21.3

Describe the bug Attempting to import SDK results in an exception caused by syntax that's not supported in node 14:

SyntaxError: Unexpected token '??='

To Reproduce

npm i @azure/core-rest-pipeline

Then run the following trivial script:

// index.js
require('')

to get the following error:

/[...]/node_modules/@azure/core-rest-pipeline/dist/commonjs/policies/multipartPolicy.js:99
            boundary ??= parsedBoundary;
                     ^^^

SyntaxError: Unexpected token '??='

Expected behavior Since previous version of the package did support node 14, the new version should either stay backwards compatible or be published as a major release.

Additional context I ended up here by debugging a problem with rush utility which used to work for me until yesterday and now it suddenly broke because of the reason explained above. Even though @rushstack/rush-azure-storage-build-cache-plugin is actually careful enough to only require patch updates from @azure/identity:

https://github.com/microsoft/rushstack/blob/main/rush-plugins/rush-azure-storage-build-cache-plugin/package.json#L21C1-L21C33

  "dependencies": {
    "@azure/identity": "~4.0.0",
    ...
  },

this doesn't help in this case since @azure/identity is more permissive:

https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/package.json#L108

  "dependencies": {
    "@azure/abort-controller": "^1.0.0",
    "@azure/core-auth": "^1.5.0",
    "@azure/core-client": "^1.4.0",
    "@azure/core-rest-pipeline": "^1.1.0",
    // ...
  },

A possible solution for this would be to publish a patch for @azure/core-rest-pipeline with the syntax reverted to a more compatible version.

hi
can you suggest me a solution for @azure/storage-blob": "^12.2.0" package , its giving me same error ,
Should i downgrade the version of nodejs?

SyntaxError: Unexpected token '??='
pollUntilDone: (pollOptions) => (resultPromise ??= (async () => {

opt/app/node_modules/@azure/core-lro/dist/commonjs/poller/poller.js:81

@maorleger
Copy link
Member

Hi @iswarrawat - what version of node are you using currently?

@sfc-gh-pmotacki
Copy link

sfc-gh-pmotacki commented Mar 26, 2024

Hi @maorleger. I have the same problem like @iswarrawat and I still need a support for node14.
SyntaxError: Unexpected token '??=' pollUntilDone: (pollOptions) => (resultPromise ??= (async () => {

Any idea to solve other than resigning from v14?

@iswarrawat
Copy link

yes you can update that specific library in which the issue is coming
like i have this issue in opt/app/node_modules/@azure/core-lro/dist/commonjs/poller/poller.js
dependency :
@azure/core-lro

this is the library in which i am getting that issue so i update the version in which
this case is handled in different approach

(pollOptions) => (resultPromise ??= (async () => {

@maorleger
Copy link
Member

Hi @maorleger. I have the same problem like @iswarrawat and I still need a support for node14. SyntaxError: Unexpected token '??=' pollUntilDone: (pollOptions) => (resultPromise ??= (async () => {

Any idea to solve other than resigning from v14?

Hey @sfc-gh-pmotacki - the only thing I could think of if you must support node 14 is to use a transpiler like Babel that may be able to transpile the nullish coalescing operator to something that is supported in Node 14.

Aside from that, you could lock your core package dependencies to a previous version that supported Node 14 although we recommend against that #28918 (comment)

timovv added a commit that referenced this issue Mar 28, 2024
### Packages impacted by this PR

- Core packages using ESM migration

### Issues associated with this PR

- #28940
- #28918

### Describe the problem that is addressed by this PR

Upgrade to new version of `tshy` which does not force `target` to
`ES2022` (see [PR](isaacs/tshy#55)). This should
resolve some issues for people whose environments do not support newer
syntax (e.g. Node 14 and the Webpack 4 bundler).
@NNG9y1PQdXl
Copy link

hi can you suggest me a solution for @azure/storage-blob": "^12.2.0" package , its giving me same error , Should i downgrade the version of nodejs?

SyntaxError: Unexpected token '??=' pollUntilDone: (pollOptions) => (resultPromise ??= (async () => {

opt/app/node_modules/@azure/core-lro/dist/commonjs/poller/poller.js:81

@iswarrawat I can confirm that #29111 - which was released for @azure/core-lro_2.7.2 in #29238 has fixed the same issue for my app, so you shouldn't need any additional fix at this point, just please try building it as usual.

@xirzec
Copy link
Member

xirzec commented Apr 11, 2024

I believe with yesterday's core release we have fixed the compiler target to be compatible with older Node again. Please let us know if you are still seeing syntax errors.

@xirzec xirzec closed this as completed Apr 11, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

8 participants