Prasath S
Prasath S

Reputation: 4416

Correct way to add PRIVATE_KEY in Glitch .env?

I'm following this document to add PRIVATE_KEY in, https://glitch.com/, in this documentation they mentioned like this,

  1. Click on the file ".env" on the left sidebar, then click on ✏️ Plain text on top. Do not edit it directly from UI as it will break your key formatting.
  1. Edit it with your private key and passphrase. Make sure a multiline key has the same line breaks like below. Env variables are only visible to the owner of the Glitch project. Use a separate private key for testing only, and not your production key.

Below is the code sample they have provided

PASSPHRASE="my-secret"

PRIVATE_KEY="-----[REPLACE THIS] BEGIN RSA PRIVATE KEY-----
MIIE...
...
...xyz
-----[REPLACE THIS] END RSA PRIVATE KEY-----"

So, as in the Documentation, I Added like below,

PRIVATE_KEY=-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,87FC14DC89A1E88F

1mSlTt5heI/noo0wpvwp8P0bqUomF7ehu+NxuNd5BpKh9dZnsUpXVxEI4f3jZCQa
1mSlTt5heI/noo0wpvwp8P0bqUomF7ehu+NxuNd5BpKh9dZnsUpXVxEI4f3jZCQa
..bla bla bla,,
+bg/t1nX7NnA/5OwvJxyOeC7va9HrFpmN8JBDWVjshsBvUcgk2sHCyG0rsepCgVY
-----END RSA PRIVATE KEY-----

that looks like this in .env UI

but, when I try to check I the availability,

if (!PRIVATE_KEY) {
    throw new Error(
      'Private key is empty. Please check your env variable "PRIVATE_KEY".'
    );
  }

I'm getting the below error

Error: Private key is empty. Please check your env variable "PRIVATE_KEY".

What went wrong with this? Thanks in Advance

enter image description here

Upvotes: 0

Views: 109

Answers (0)

Related Questions