Buffer is not defined
See original GitHub issueHello,
Since I last dropped my node_modules and reinstalled them, an error appeared:
Buffer is not defined
In /modules/angular-auth-oidc-client.es5.js TokenHelperService.urlBase64Decode
The “compiled” code is the following:
TokenHelperService.prototype.urlBase64Decode = function (str) {
var /** @type {?} */ output = str.replace('-', '+').replace('_', '/');
switch (output.length % 4) {
case 0:
break;
case 2:
output += '==';
break;
case 3:
output += '=';
break;
default:
throw Error('Illegal base64url string!');
}
return new Buffer(output, 'base64').toString('binary');
};
But went I look at the source code, I see :
urlBase64Decode(str: string) {
let output = str.replace('-', '+').replace('_', '/');
switch (output.length % 4) {
case 0:
break;
case 2:
output += '==';
break;
case 3:
output += '=';
break;
default:
throw Error('Illegal base64url string!');
}
return typeof window !== 'undefined' ? window.atob(output) : new Buffer(output, 'base64').toString('binary');
}
I assume there is a release/publish problem, the package on npm not being the latest version ?
Best regards
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Uncaught ReferenceError: Buffer is not defined - Stack Overflow
Answering my own question. Two things helped to resolve the issue: Adding plugins section with ProviderPlugin into webpack.config.js.
Read more >Uncaught ReferenceError: Buffer is not defined #1626 - GitHub
Trying to bundle a project which includes https://solana-labs.github.io/wallet-adapter. First, I had a problem with global not being defined ...
Read more >Buffer is not defined. Using Phantom Wallet, Solana and ...
This is happening because the default bundler that comes with create react app(webpack 5) does not polyfill Buffer .
Read more >How to polyfill Buffer with Webpack 5 - viglucci.io
The "buffer is not defined" error is a common error that can occur when trying to use the Buffer Node.js API in an...
Read more >ReferenceError: Buffer is not defined - Homey Community Forum
Buffer is a global variable set by homeyscript. Now it is not defined anymore. Why do you need the script? If you think...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@damienbod
Ran a test using 6.0.5, it appears to be working as of now. I also changed my package to use
^6.0.0
and all is still well. Thanks for the prompt response.@Booster2ooo @bereachad
Thanks for reporting.