base64url
base64url copied to clipboard
Buffer is not defined
we recently upgraded our application to angular 6 and RxJs 6. Now I get the following error when trying to encode/decode
Uncaught ReferenceError: Buffer is not defined at encode (base64url.js:5) at Observable._zoneSubscribe (file-upload-service.ts:160) at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable.subscribe [as __zone_symbol__subscribe] (Observable.js:161) at Observable.value [as subscribe] (zone-patch-rxjs.js:95) at CatchOperator.push../node_modules/rxjs/_esm5/internal/operators/catchError.js.CatchOperator.call (catchError.js:17) at Observable.push../node_modules/rxjs/_esm5/internal/Observable.js.Observable.subscribe [as __zone_symbol__subscribe] (Observable.js:158) at Observable.value [as subscribe] (zone-patch-rxjs.js:95) at subscribeTo.js:21 at subscribeToResult (subscribeToResult.js:6) at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber._innerSub (mergeMap.js:127)
I'm using base64url 3.0.0 with typescript. I also needed to manually add the following to your package.json to get it to work with noImpliciteany set to true.
"typings": "./dist/base64url.d.ts"
this issue has already been reported (https://github.com/brianloveswords/base64url/issues/29)
regards Ramila
having this issue too
This should be fixed in 3.0.1
https://github.com/brianloveswords/base64url/pull/32
Doesnt work with Angular 7 still getting buffer is not defined, can someone else confirm?
Same thing here.
So I'm guessing people are getting this error when using it in the browser. Reopening
Yes for me, I wanted to use it in a angular project.
Maybe installing this lib could be enough? I’ill give it a try https://www.npmjs.com/package/buffer
For now , I have added this in my polyfill.js to fix this error.
global.Buffer = global.Buffer || require('buffer').Buffer;
and also installed package buffer from npm
npm install buffer --save-dev
Hi, any update for this one ?
Because this ticket exists nearly two years now... Any update on this?
I will remove myself from the notifications. For my project, I used js-base64 and it was good enough for my need.
I'm getting this as well. Using 3.0.1. Trying to use in browser.
Still an issue on latest version. I used it in angular 7.2.4. Not for all data. Only some.
Any update on this issue guy's!.......am using "base64url": "^3.0.1", & "typescript": "^4.9.5",
edit:- this https://stackoverflow.com/questions/44458874/how-to-base64-encode-inputs-in-react helped some ppl but in my case am still getting "Buffer is not defined"