WARNING in ./node_modules/enc-utils/dist/cjs/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from ‘/node_modules/enc-utils/src/index.ts’ file: Error: ENOENT: no such file or directory, open '/node_modules/enc-utils/src/index.ts’
Also, kindly provide the Web3Auth initialization and login code snippet below. This will help us better understand your issue and provide you with the necessary assistance.
Thank you for providing detailed information about your issue. Let’s break down the key points:
SDK Details: You’re using the Web3Auth PnP Web SDK.
SDK Version: ^9.7.0
Platform: React
Issue: The main error message is “Buffer is not defined” in the browser console. This is usually related to the environment configuration when using Node.js packages in a browser environment. Additionally, you mentioned a warning about failing to parse the source map for the enc-utils package.
Suggested Solutions:
Buffer Error: The “Buffer is not defined” issue is common when the buffer isn’t polyfilled in a React or Web environment. You can add the following polyfill to the top of your main entry file (e.g., index.js):
import { Buffer } from 'buffer';
window.Buffer = Buffer;
You might need to install the buffer package using npm:
npm install buffer
Source Map Warning: This warning is usually related to development build configurations and missing source map files. It doesn’t often impact functionality but can be addressed by ensuring correct build configurations or ignoring the warning:
Add the following to your webpack.config.js (if applicable):
module.exports = {
// ... rest of your webpack config
devtool: 'source-map', // or 'inline-source-map'
resolve: {
fallback: {
buffer: require.resolve('buffer/') // ensures Buffer polyfill is available
}
}
};
For Web3Auth Configuration: Your initialization and login snippet looks correctly set up for the Avalanche C-Chain Testnet. Ensure your clientId is correctly provided and that the AVAX RPC URL is working properly.
Please try these steps, and let me know if you need further assistance. We’re here to help!
Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.
Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. Web3Auth Developer Office Hours