Back

"Signing key cannot be empty" with GitHub Integration on 1.4.7

  • 0
  • Self Hosted
  • Functions
! $π’‰π’‚π’…π’π’˜ β„œΓœκž¨αΉͺ π’˜π’Šπ’›π’‚π’“π’…
26 Oct, 2023, 01:48
  • "Error 500"
  • "Signing key cannnot be empty"
  • Type: general_unknown

I will provide an error trace.

TL;DR
The user is experiencing an issue with the GitHub integration on version 1.4.7. They have tried various solutions including hard coding the key, saving it as a Docker swarm secret, and passing the variables through Portainer. They suggest copying and pasting the private key into Portainer without making any tweaks. They also provide a script to format the private key properly. Another user suggests checking if the `_APP_VCS_GITHUB_PRIVATE_KEY` environment variable is being outputted as multiple lines. The conversation ends with the user noticing a syntax issue with the private key in the .env file, which may be causing the error. The
Drake
26 Oct, 2023, 02:22

Something is wrong with the private key you put in the .env file

! $π’‰π’‚π’…π’π’˜ β„œΓœκž¨αΉͺ π’˜π’Šπ’›π’‚π’“π’…
26 Oct, 2023, 02:34

I see, so something is wrong with the _APP_VCS_GITHUB_PRIVATE_KEY env variable? I have it currently reading like this : ` _APP_VCS_GITHUB_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nMEEEpAEEEEEEEE\nEEEEE\nKL4LEFQ==\n-----END RSA PRIVATE KEY-----"

Obviously not the full key but I noticed inside the error trace, it shows -----BEGIN RSA PRIVATE KEY-----n with an additional ? Could that be it?

Drake
26 Oct, 2023, 02:39

possibly...can you try running this:

TypeScript
#!/bin/sh

CODE='
if (openssl_pkey_get_private(getenv("_APP_VCS_GITHUB_PRIVATE_KEY")) === false) {
    echo "Invalid Private Key\n";
    exit(1);
} else {
    echo "Valid Private Key\n";
    exit(0);
}'

docker compose exec appwrite php -r "$CODE"
Drake
26 Oct, 2023, 02:40

it looks like that in your .env file?

Drake
26 Oct, 2023, 02:41

if you run docker compose exec appwrite vars you should see the variable output into multiple lines. is that what you see?

Drake
26 Oct, 2023, 02:42

here's also a script to format the private key:

TypeScript
#!/bin/bash

if [ -z "$1" ]; then
    echo "Usage: $0 <path to private key file>"
    exit 1
fi

awk '{printf "%s\\n", $0} END {print "\n"}' $1 | head -n 1 | sed 's/^/_APP_VCS_GITHUB_PRIVATE_KEY="/g' | sed 's/$/"/g'
! $π’‰π’‚π’…π’π’˜ β„œΓœκž¨αΉͺ π’˜π’Šπ’›π’‚π’“π’…
26 Oct, 2023, 03:35

I am not using an env file I am currently passing the variables through portainer.

Drake
26 Oct, 2023, 03:35

ugh...portainer...

Drake
26 Oct, 2023, 03:36

try this script

! $π’‰π’‚π’…π’π’˜ β„œΓœκž¨αΉͺ π’˜π’Šπ’›π’‚π’“π’…
26 Oct, 2023, 03:47

Okay now going to run the code

! $π’‰π’‚π’…π’π’˜ β„œΓœκž¨αΉͺ π’˜π’Šπ’›π’‚π’“π’…
26 Oct, 2023, 03:49

I see it saying invalid private key, hmm

Drake
26 Oct, 2023, 03:50

Um that's not the right way to execute the script...

! $π’‰π’‚π’…π’π’˜ β„œΓœκž¨αΉͺ π’˜π’Šπ’›π’‚π’“π’…
26 Oct, 2023, 03:50

Yeah xD I am doing that next

Drake
26 Oct, 2023, 03:51

Anyways...try copying and pasting the private key into portainer without any tweaks

! $π’‰π’‚π’…π’π’˜ β„œΓœκž¨αΉͺ π’˜π’Šπ’›π’‚π’“π’…
26 Oct, 2023, 19:59

I tried to save it as a docker swarm secret and still seem to be having issues with it.

! $π’‰π’‚π’…π’π’˜ β„œΓœκž¨αΉͺ π’˜π’Šπ’›π’‚π’“π’…
26 Oct, 2023, 20:00

Granted its not a big deal , I could just deploy from the github repo directly

Drake
26 Oct, 2023, 20:15

somewhere along the way, some formatting is getting screwed up

! $π’‰π’‚π’…π’π’˜ β„œΓœκž¨αΉͺ π’˜π’Šπ’›π’‚π’“π’…
26 Oct, 2023, 20:27

From my experience this tends to be an issue with multi-line environmental variables. I could hard code it in but that isnt worth the security risk.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more