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

TypeError: The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received undefined #305

Closed
theindianappguy opened this issue Apr 10, 2021 · 10 comments · Fixed by #345

Comments

@theindianappguy
Copy link

Screenshot 2021-04-10 at 8 08 10 AM

I see this as soon as i download and run with

yarn
yarn dev

@leerob
Copy link
Owner

leerob commented Apr 11, 2021

Hmmm, what version of Node.js are you using?

@fizerkhan
Copy link

Same error. Node version - v14.15.3

@haafidz-jp
Copy link

same problem node - v14.15.3

@leerob
Copy link
Owner

leerob commented Apr 14, 2021

Do you only see this when using next dev? Or is it with next build too?

@haafidz-jp
Copy link

error
im using yarn dev. and local .env

@3rg1s
Copy link

3rg1s commented Apr 14, 2021

Do we have any fix for this issue yet? I tried to resolve it but didn't manage to get it fixed.

I had the project running by removing the googleapis package on the package.json file. But the home page is giving an error:

451 – Unavailable For Legal Reasons

@jeremycos
Copy link

Hello. I had the same problem.

It comes from the @lib/google with the crypto library. So I removed the entire @lib/google and all references (with youtube) in index.js. And now it works fine.

@omaralsoudanii
Copy link
Contributor

@leerob not sure if this helps or not, but i think the cypher is generated through OpenSSL and between v.14.15.3 to the current LTS version there is a lot of changes in this area ( due to patched OpenSSL vulnerability ).

So maybe it doesn't work because you have the newer version with the patched OpenSSL stuff and the others don't.

Check the changelogs

@Deep-Codes
Copy link
Contributor

Hello. I had the same problem.

It comes from the @lib/google with the crypto library. So I removed the entire @lib/google and all references (with youtube) in index.js. And now it works fine.

This works tho a lot of work 😅

@NickCrews
Copy link

I'm pretty sure the problem is that people haven't fully followed the instructions, and they haven't copied .env.example into .env.local and actually filled in values for GOOGLE_ENCRYPTION_KEY and GOOGLE_ENCRYPTION_IV. I had this issue, and then filled in these values with 1234. Then at least the error changed to the thing below, which I assume is "You're not using a valid encryption key, you doofus," which makes sense since. @leerob I bet you could reproduce this if you deleted those entries in your .env.local?

I'd imagine the workaround is either

  1. Add valid GOOGLE_ENCRYPTION_* variables
  2. Remove all the offending code as @jeremycos suggests
  3. Make things fail more gracefully, so if you don't have valid keys then your youtube API calls etc should return some empty placeholders. I'm trying to do this and plan to submit a PR here.

image

NickCrews added a commit to NickCrews/blahg that referenced this issue Jun 19, 2021
See leerob#305

It would probably be useful for folks just cloning the repo
and immediately running things (i.e. me) to warn them that they
haven't fully set things up.

I'm not sure if `console.warn()` is the best method for this,
I'm no expert in node or nextjs.
NickCrews added a commit to NickCrews/blahg that referenced this issue Jun 19, 2021
See leerob#305

This only covers the problem for a single environment
variable. If the rest of `.env.local` isn't set, then
you will run into problems later. For instance `/guestbook`
will not load because it tries to use redis, and `REDIS_URL`
isn't set.

I figured if we covered the index page though it might be nice.
IDK, maybe all this extra error handling isn't worth it, and
we should just crash and burn early.
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

Successfully merging a pull request may close this issue.

9 participants