Add ssh private key using env variable - Error loading key "/dev/fd/63": invalid format


I have a private gitlab repository as a package in my package.json for my react app. So I need to add a ssh key before downloading my dependencies. I added an env variable GIT_SSH_KEY_GITLAB and tried to use it like this (extract from my render.yaml):

  - type: web
    name: "MYREACTAPP"
    env: static
    branch: develop
    staticPublishPath: ./app/dist
    buildCommand: eval `ssh-agent -s`; ssh-add - <<< "${GIT_SSH_KEY_GITLAB}"; pnpm i; pnpm build:all
      - key: GIT_SSH_KEY_GITLAB
        sync: false
      - key: SKIP_INSTALL_DEPS
        value: true
    autoDeploy: false

But I get this error when executing the build command :

Error loading key "/dev/fd/63": invalid format

I tried to add /n in my private key, with and without quotes,… but nothing seems to work. My key is valid and there is “-----BEGIN OPENSSH PRIVATE KEY-----” at the begining and “-----END OPENSSH PRIVATE KEY-----” at the end.

Someone has an idea of what could make it work ?
Thank you and have a nice day !

Hi @soyeloso, welcome to the Render community! Through some searches, it seems like this error typically comes up when there is an issue with secret not be properly base64 encoded. You may also need to use the decoded version when referencing it in your build command, like so: "Enter passphrase for /dev/fd/63" error (#1) · Issues · GitLab-examples / ssh-private-key · GitLab

We’re happy to take a closer look as well - can you DM me the email associated with your Render account?