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

Unable to resolve crypto #1220

Closed
Shahanshah-TA opened this issue Apr 1, 2024 · 0 comments
Closed

Unable to resolve crypto #1220

Shahanshah-TA opened this issue Apr 1, 2024 · 0 comments
Labels

Comments

@Shahanshah-TA
Copy link

Installed packages
"azure-iot-provisioning-device": "^1.9.1", "azure-iot-provisioning-device-mqtt": "^1.8.1", "azure-iot-security-symmetric-key": "^1.8.2",

Error: Unable to resolve module crypto from /node_modules/azure-iot-common/dist/authorization.js: crypto could not be found within the project or in these directories:
node_modules
../node_modules
5 | Object.defineProperty(exports, "__esModule", { value: true });
6 | exports.hmacHash = exports.stringToSign = exports.encodeUriComponentStrict = exports.anHourFromNow = void 0;

7 | const crypto = require("crypto");

Using in react native bare project.

shims.js
import 'react-native-url-polyfill/auto'; import 'react-native-get-random-values'; import 'text-encoding-polyfill'; const getRandomValues = global.crypto.getRandomValues; import * as crypto from 'isomorphic-webcrypto'; global.crypto = crypto; global.crypto.getRandomValues = getRandomValues;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant