azure-sdk-for-js: 05/01/2025 builds break with jest v27 @typespec/ts-http-runtime/internal/*

  • Package Name: @typespec/ts-http-runtime
  • Package Version: 0.2.2
  • Operating system: Ubuntu 20.04.6 LTS (Focal Fossa)
  • nodejs
    • version: v20.9.0
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug the newest azure package versions released yesterday 5/1/25 all fail to reference @typespec/ts-http-runtime/internal/* where * could be many things depending on which azure package is being used. ive found the error for utils, logger and policies, but i would assume this is happening for all of them.

this error wasnt happening yesterday and is specifically happening with jest v27. Upgrading to v29 does fix the issue but it would be nice if it would be backwards compatible.

change log of issue

To Reproduce Steps to reproduce the behavior:

  1. mkdir repro_test
  2. cd repro_test
  3. npm init
  4. npm install jest@27.X
  5. npm install @azure/logger
  6. echo “test(‘test’, () => { const x = require(‘@azure/logger’); });” > index.test.js
  7. npx jest

Expected behavior package imported and test runs and finishes.

Screenshots If applicable, add screenshots to help explain your problem.

Image

Image

Image

Additional context Cannot find module '@typespec/ts-http-runtime/internal/logger' from 'node_modules/@azure/logger/dist/commonjs/index.js'

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 17 (6 by maintainers)

Most upvoted comments

You can map the internal path directly to the correct /dist/commonjs folder with moduleNameMapper. Jest is then able to resolve the dependencies. In package.json

"jest": {
    "moduleNameMapper": {
      "^@typespec/ts-http-runtime/internal/(.*)$": "<rootDir>/node_modules/@typespec/ts-http-runtime/dist/commonjs/$1/internal.js"
  }
}

In my case tests ran same as before after adding the mapping.

@timovv , I’m going to try that @jeremymeng We are currently , but slowly migrating our product towards vue3 but until then I will have to use Vue2 Thank you for the comprehensive list, I was able to work around this issue. I just had to override two dependencies:


 "overrides": {
   "@azure/core-util": "1.11.0",
   "@azure/logger": "1.1.4"
 },

@mhaiderWx right, vue v2 is EOL and not supported. It doesn’t even support NodeJS v18. When using yarn it failed to install.

added: vue v3 works fine.

with that said, if you need a workaround, you could pin our core packages to the previous version with “overrides” or “resolutions”, depending on your package manager

  "overrides": {
    "@azure-rest/core-client": "2.3.5",
    "@azure/logger": "1.1.4",
    "@azure/core-util": "1.11.0",
    "@azure/core-client": "1.9.3",
    "@azure/core-rest-pipeline": "1.19.1"
  },
  "resolutions": {
    "@azure-rest/core-client": "2.3.5",
    "@azure/logger": "1.1.4",
    "@azure/core-util": "1.11.0",
    "@azure/core-client": "1.9.3",
    "@azure/core-rest-pipeline": "1.19.1"
  }

It appears that @vue/cli-service version 4 has a dependency on Webpack 4, which also does not support subpath exports (see https://github.com/webpack/webpack/issues/9509) and hasn’t seen updates since 2023. @vue/cli-service v5 seems to pull in a newer version of Webpack and resolves the issue on my machine. If possible (I’m not sure how Vue’s dependencies work) I would advise upgrading that.

Was battling with the same issue for couple of days now. thanks @mfink-db for raising this issue and @MarkoMikaelT for providing the workaround.

Hi @leepk29 – the Azure SDK only supports LTS versions of Node (with some buffer, see our support policy for details). Node 14 reached end-of-life in 2023 and so is not supported. I would recommend updating to an active LTS version of Node (at this time, Node 20 or later); that should resolve your issue.