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

older node.js doesn't have a btoa function #47

Closed
brianleroux opened this issue Aug 18, 2022 · 4 comments
Closed

older node.js doesn't have a btoa function #47

brianleroux opened this issue Aug 18, 2022 · 4 comments

Comments

@brianleroux
Copy link

unfortunately AWS Lambda runs Node 16.x for the moment; cooked a little workaround for now in case this is helpful for someone

Screen Shot 2022-08-18 at 2 26 51 PM

@dgraham
Copy link
Member

dgraham commented Aug 18, 2022

Node 16 should have btoa. Are you sure this isn't running an even older Node 14 version?

$ node -v                          
v16.13.2
$ node -e "console.log(btoa('hi'))"
aGk=

$ node -v                            
v14.15.4
$ node -e "console.log(btoa('hi'))"
ReferenceError: btoa is not defined

@brianleroux
Copy link
Author

omfg I was using a hack project that fell out of date! don't mind me nothing to see here =P

great work on this feature / smoking fast even w a cold start. been waiting to say that about sql on lambda for seven years.

@brianleroux
Copy link
Author

Some further context; would be worth revisiting btoa after all.

https://twitter.com/addaleax/status/1560386570062028804?t=M2R4ilUfhp2ls0Qu20BwTQ&s=19

@dgraham
Copy link
Member

dgraham commented Aug 19, 2022

Thanks for those details. We can reliably use the implementations of btoa in browsers and in Node's standard library to base64 encode the Authorization header value for transport to the servers to which this library connects. We'll revisit if there's a problem in the future. Thanks!

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

No branches or pull requests

2 participants