Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.03k stars 1.19k forks source link

export 'SpanStatusCode' (imported as 'SpanStatusCode') was not found in '@azure/core-tracing' (possible exports: createTracingClient, useInstrumenter) #29844

Closed govindaraja91 closed 3 months ago

govindaraja91 commented 3 months ago

Screenshots

Screenshot 2024-05-29 at 3 34 11 PM
github-actions[bot] commented 3 months ago

@jeremymeng @maorleger @mpodwysocki

github-actions[bot] commented 3 months ago

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

maorleger commented 3 months ago

Hi there @govindaraja91 - thanks for reaching out about this. It seems as though you might have a very outdated version of core-tracing that is for some reason being picked up. To debug this, I'd need some more information from you.

Could you help me with this?

The most helpful thing would be a small reproducible example if you can share it. Those will get you the fastest response. I know that's not always possible, so if you could answer the following questions that would help!

Thanks so much!

github-actions[bot] commented 3 months ago

Hi @govindaraja91. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

govindaraja91 commented 3 months ago

Hi @maorleger,

I have not specifically installed @azure/core-tracing. I have the following packages in my package.json and here you can find the version of @azure/storage-blob

@azure/app-configuration: "1.6.0"
@azure/identity: "4.2.0"
@azure/storage-blob: "12.18.0"

And here is output for npm ls @azure/core-tracing

├─┬ @azure/app-configuration@1.6.0
│ ├─┬ @azure/core-client@1.9.2
│ │ └── @azure/core-tracing@1.1.2 deduped
│ ├─┬ @azure/core-rest-pipeline@1.16.0
│ │ └── @azure/core-tracing@1.1.2 deduped
│ └── @azure/core-tracing@1.1.2
├─┬ @azure/identity@4.2.0
│ └── @azure/core-tracing@1.1.2 deduped
└─┬ @azure/storage-blob@12.18.0
  ├─┬ @azure/core-http@3.0.4
  │ └── @azure/core-tracing@1.0.0-preview.13
  └── @azure/core-tracing@1.0.0-preview.13

I tried many times deleting the package-lock.json and node_modules and reinstalling all the packages. Still, I got the same error.

package.json

{
    "name": "******",
    "version": "***",
    "description": "",
    "type": "module",
    "main": "server.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1",
        "start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config ./webpack-config/webpack.dev.js"
    },
    "author": "*******",
    "license": "UNLICENSED",
    "imports": {
        "*****": "****"
    },
    "dependencies": {
        "@azure/app-configuration": "1.6.0",
        "@azure/identity": "4.2.0",
        "@azure/storage-blob": "12.18.0",
        "async": "3.2.5",
        "aws-sdk": "2.1625.0",
        "axios": "1.7.2",
        "bcrypt": "5.1.1",
        "body-parser": "1.20.2",
        "canvas": "2.11.2",
        "compression": "1.7.4",
        "connect-redis": "7.1.1",
        "cookie-parser": "1.4.6",
        "dotenv": "16.4.5",
        "ejs": "3.1.10",
        "esm": "3.2.25",
        "express": "4.19.2",
        "express-rate-limit": "7.2.0",
        "express-session": "1.18.0",
        "fcm-node": "1.6.1",
        "gm": "1.25.0",
        "helmet": "7.1.0",
        "hot-formula-parser": "4.0.0",
        "joi": "17.13.1",
        "jsonwebtoken": "9.0.2",
        "lodash": "4.17.21",
        "mixpanel": "0.18.0",
        "mkdirp": "3.0.1",
        "moment": "2.30.1",
        "morgan": "1.10.0",
        "multer": "1.4.3",
        "nanoid": "5.0.7",
        "nodemailer": "6.9.13",
        "passport": "0.7.0",
        "passport-local": "1.0.0",
        "pg": "8.11.5",
        "pug": "3.0.2",
        "puppeteer": "22.9.0",
        "q": "1.5.1",
        "query-string": "9.0.0",
        "rate-limit-redis": "4.2.0",
        "redis": "4.6.14",
        "request": "2.88.2",
        "semver": "7.6.2",
        "serve-favicon": "2.5.0",
        "sql-template-strings": "2.2.2",
        "ua-parser-js": "1.0.37",
        "uuid": "9.0.1",
        "winston": "3.13.0",
        "x2js": "3.4.4"
    },
    "devDependencies": {
        "@azure/storage-blob": "12.18.0",
        "@babel/core": "7.24.5",
        "@babel/plugin-transform-class-properties": "7.24.1",
        "@babel/plugin-transform-runtime": "7.24.3",
        "@babel/preset-env": "7.24.5",
        "@babel/preset-flow": "7.24.1",
        "@babel/preset-react": "7.24.1",
        "@heroicons/react": "2.1.3",
        "@popperjs/core": "2.11.8",
        "@reduxjs/toolkit": "2.2.5",
        "@sentry/react": "8.5.0",
        "@tremor/react": "3.17.2",
        "ace-builds": "1.4.14",
        "async": "3.2.5",
        "autoprefixer": "10.4.19",
        "axios": "1.7.2",
        "babel-loader": "9.1.3",
        "babel-plugin-transform-remove-imports": "1.7.1",
        "css-loader": "7.1.1",
        "draft-js": "0.11.7",
        "draft-js-export-html": "1.4.1",
        "draftjs-utils": "0.10.2",
        "exceljs": "4.3.0",
        "extra-watch-webpack-plugin": "1.0.3",
        "file-loader": "6.2.0",
        "file-saver": "2.0.5",
        "html-to-draftjs": "1.5.0",
        "immer": "10.1.1",
        "joi": "17.13.1",
        "jquery": "3.7.1",
        "lodash": "4.17.21",
        "mixpanel-browser": "2.50.0",
        "moment": "2.30.1",
        "nanoid": "5.0.7",
        "node-gyp": "10.1.0",
        "postcss": "8.4.38",
        "postcss-import": "16.1.0",
        "postcss-loader": "8.1.1",
        "qs": "6.12.1",
        "react": "18.3.1",
        "react-ace": "10.1.0",
        "react-beautiful-dnd": "13.1.1",
        "react-data-grid": "7.0.0-beta.12",
        "react-datepicker": "6.9.0",
        "react-dom": "18.3.1",
        "react-dropzone": "12.0.4",
        "react-error-boundary": "3.1.4",
        "react-google-recaptcha": "3.1.0",
        "react-highlight-words": "0.20.0",
        "react-infinite-scroll-component": "6.1.0",
        "react-mentions": "4.3.0",
        "react-popper": "2.3.0",
        "react-redux": "9.1.2",
        "react-router-dom": "6.23.1",
        "react-select": "5.8.0",
        "react-sortable-hoc": "2.0.0",
        "react-toastify": "10.0.5",
        "react-virtualized": "9.22.5",
        "style-loader": "4.0.0",
        "tailwindcss": "3.4.3",
        "url-loader": "4.1.1",
        "use-immer": "0.9.0",
        "webpack": "5.91.0",
        "webpack-bundle-analyzer": "4.10.2",
        "webpack-cli": "5.1.4",
        "webpack-dev-server": "5.0.4",
        "webpack-merge": "5.10.0",
        "xlsx": "0.18.5"
    },
    "overrides": {
        "react-sortable-hoc": {
            "react": "18.3.1",
            "react-dom": "18.3.1"
        },
        "react-virtualized": {
            "react": "18.3.1",
            "react-dom": "18.3.1"
        }
    }
}
maorleger commented 3 months ago

Thanks for sharing that information, I'll take a closer look and try to reproduce this and let you know what I find!

maorleger commented 3 months ago

Hey @govindaraja91 - I tried to reproduce this locally but have been unable to.

Here's what I did:

  1. created a file called src/index.js with these contents:
    
    const { DefaultAzureCredential } = require("@azure/identity");
    const { BlobServiceClient } = require("@azure/storage-blob");
    const serviceClient = new BlobServiceClient(
    "<MY_URL_HERE>",
    new DefaultAzureCredential()
    );

async function main() { await serviceClient.getAccountInfo(); }

main() .then(() => console.log("Done")) .catch((ex) => console.error(ex));


2. I followed the instructions for configuring typescript as listed here: https://webpack.js.org/guides/typescript/#basic-setup including adding and configuring ts-loader
3. I setup a small repro that loads the js file and runs
4. I ran webpack in dev mode and loaded the html file that includes my script

I expected to see build errors / warnings but have not.

If you have a reproducible example that you can put on github that would help me tremendously. Otherwise, I would recommend making sure you are following the typescript setup instructions in webpack's docs and see if that helps out.

Slightly related, I noticed that TypeScript enums can be tricky as per the multiple issues logged in webpack. In this case, it looks to be isolated to enums so I would recommend making sure your setup is correct. See the [webpack issues](https://github.com/webpack/webpack/issues?q=is%3Aissue+enum+is%3Aclosed) page for issues that may help.

In order to debug this further, I would need a small repro. Thanks so much!
github-actions[bot] commented 3 months ago

Hi @govindaraja91. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

govindaraja91 commented 3 months ago

Hi @maorleger - Thank you for your response. I have created a repository on GitHub to reproduce this warning and have sent you an invitation for this repo. Please check it.

P.S. You need to download both repositories.

maorleger commented 3 months ago

Hey @govindaraja91 - I took a look at the repro, thank you for sharing!

I can confirm that upgrading to @azure/storage-blob@12.23.0 should remove the warning (I just tested this).

Please note that you have "@azure/storage-blob" listed as a dependency in both dependencies and devDependencies so you should either:

  1. Update both
  2. Remove one (the devDependencies entry is not needed)

After upgrading please ensure you have the latest version by running npm ls @azure/storage-blob before testing. See an example below:

azure_blob_server main % 
azure_blob_server main % npm ls  @azure/storage-blob
azure-blob@0.0.1 /home/maorleger/workspace/29844/azure_blob_server
└── @azure/storage-blob@12.23.0

Hope that helps!

github-actions[bot] commented 3 months ago

Hi @govindaraja91. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

govindaraja91 commented 3 months ago

Hi @maorleger. Yes, no warnings now. Thank you so much ❤️