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

Cannot find module 'node_modules\call-bind\index.js' #16882

Closed
1 of 6 tasks
andreehultgren opened this issue Aug 12, 2021 · 4 comments
Closed
1 of 6 tasks

Cannot find module 'node_modules\call-bind\index.js' #16882

andreehultgren opened this issue Aug 12, 2021 · 4 comments
Assignees
Labels
Azure.Identity 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. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@andreehultgren
Copy link

andreehultgren commented Aug 12, 2021

  • @azure/identity:
  • 1.5.0:
  • Windows:
  • nodejs
    • v14.17.0:
  • browser
    • chrome/:
  • typescript
    • None:
  • Is the bug related to documentation in

Describe the bug
Reproducing the example at https://www.npmjs.com/package/@azure/identity#user-content-examples does not work. The compiler crashes.

To Reproduce
Run the following commands in order

  1. npx create-react-app test
  2. cd test
  3. yarn add @azure/identity

Then add attempt to create a DefaultAzureCredential

import { DefaultAzureCredential } from "@azure/identity";
let access = new DefaultAzureCredential()

Then run

yarn start

Expected behavior
The following error should show up

yarn run v1.22.5
$ react-scripts start
internal/modules/cjs/loader.js:443
      throw e;
      ^

Error: Cannot find module 'C:\Users\andre\test\node_modules\call-bind\index.js'
    at createEsmNotFoundErr (internal/modules/cjs/loader.js:912:15)
    at finalizeEsmResolution (internal/modules/cjs/loader.js:905:15)
    at resolveExports (internal/modules/cjs/loader.js:437:14)
    at Function.Module._findPath (internal/modules/cjs/loader.js:477:31)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:872:27)
    at Function.Module._load (internal/modules/cjs/loader.js:730:27)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\andre\test\node_modules\object.getownpropertydescriptors\index.js:4:16)
    at Module._compile (internal/modules/cjs/loader.js:1068:30) {
  code: 'MODULE_NOT_FOUND',
  path: 'C:\\Users\\andre\\test\\node_modules\\call-bind\\package.json'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Note
Running yarn add call-bind does not solve the issue.

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Aug 12, 2021
@ramya-rao-a ramya-rao-a added Azure.Identity Client This issue points to a problem in the data-plane of the library. labels Aug 12, 2021
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 12, 2021
@sadasant
Copy link
Contributor

Hello @andreehultgren! I’ll be doing my best to help you.

Please give us some time to catch up. I’ll come back with an answer between today and tomorrow.

@sadasant
Copy link
Contributor

sadasant commented Aug 12, 2021

Hello again, @andreehultgren !

I do not see the error you see. I want to understand what I’m doing differently.

Here’s what I did:

  • Installed npm i -g create-react-app.
  • Made a new folder, react-app-test.
  • In that folder, ran create-react-app test.
  • Ran yarn add @azure/identity.
  • Changed directory to the test folder cd test.
  • Edited the file: src/index.js, with the following changes:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
+ import { DefaultAzureCredential } from "@azure/identity";
+ let credential = new DefaultAzureCredential()
+ console.log({credential});

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
  • Ran yarn start. This opened a browser window. In that browser window I see the following:

30ADC081-E036-4B66-8B88-11ACEB37729B

This happens because the DefaultAzureCredential is not intended to work in the browser (note that our readme says that InteractiveBrowserCredential is the only credential that is supported in the browser).

If I switch to the InteractiveBrowserCredential, the error goes away:

import { InteractiveBrowserCredential } from "@azure/identity";
let credential = new InteractiveBrowserCredential({
  tenantId: "<YOUR_TENANT_ID>",
  clientId: "<YOUR_CLIENT_ID>"
})

Please let me know what I’m doing differently!

Also, please read our docs in regards to using Identity in the browser: Authenticating a user account interactively in the browser .

Any feedback appreciated. I’m here to help.

@andreehultgren
Copy link
Author

It seemed like the installation of one dependency (call-bind) was faulty and resulted in the file node_modules/call-bind/callBound.js missing. This package worked before installing @azure/identity. Somehow this installation removed the callBound.js file from my node_modules. Removing node_modules and reinstalling did not work. Strange...

I managed to resolve this issue by wiping NodeJS and all dependencies on the system. The file now exists and the @azure/identity now works as expected.

@sadasant
Copy link
Contributor

@andreehultgren Thank you for letting us know! Please remember you’re welcome here anytime. Good luck with your projects!

openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this issue Dec 10, 2021
Review request for Microsoft.BotService to update version stable/2021-03-01 (Azure#16882)

* fix api

* add name property

* update OP Channels_ListWithKeys

* update type

* mark the parameter value as x-ms-secret

* allow null in value

* '

* sync changes to 2021-05-01-preview

Co-authored-by: FAREAST\hond <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Identity 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. 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

3 participants