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

"KEY" Environment Variable is missing. #12202

Closed
3 tasks done
joelee2017 opened this issue Mar 17, 2022 · 8 comments
Closed
3 tasks done

"KEY" Environment Variable is missing. #12202

joelee2017 opened this issue Mar 17, 2022 · 8 comments

Comments

@joelee2017
Copy link

joelee2017 commented Mar 17, 2022

Preflight Checklist

Describe the Bug

"KEY" Environment Variable is missing.

To Reproduce

yml content :

version: '3'
services:     
  directus:
    container_name: directus
    image: directus/directus:latest 
    ports:
      - 8055:8055
    environment:
      KEY: '255d861b-5ea1-5996-9aa3-922530ec40b1'
      SECRET: '6116487b-cda1-52c2-b5b5-c8022c45e263'

      DB_CLIENT: 'mssql'
      DB_HOST: 'x.x.x.x'
      DB_PORT: 'xxxx'
      DB_DATABASE: 'directus'
      DB_USER: 'xxxxxxxx'
      DB_PASSWORD: 'xxxxxxxx' 

      ADMIN_EMAIL: 'admin@admin.com'
      ADMIN_PASSWORD: 'admin' 
networks:
  directus:

docker-compose up -d

npx directus start

Errors Shown

npx directus start
image

What version of Directus are you using?

latest

What version of Node.js are you using?

v16.14.0

What database are you using?

ms sql

What browser are you using?

Chrome

What operating system are you using?

Windows 10

How are you deploying Directus?

Docker

@azrikahar
Copy link
Contributor

Hi, unfortunately I can't seem to reproduce this on my end. Perhaps there's some indentation issue where your environment variables aren't being set properly? I'd recommend trying the following minimal compose file just to isolate any other possibilities and print out the environment variables of the container when it starts up:

services:
  directus:
    container_name: directus
    image: directus/directus:latest
    entrypoint: ["/bin/sh", "-c"]
    command: env
    ports:
      - 8055:8055
    environment:
      KEY: '255d861b-5ea1-5996-9aa3-922530ec40b1'
      SECRET: '6116487b-cda1-52c2-b5b5-c8022c45e263'
      ADMIN_EMAIL: 'admin@admin.com'
      ADMIN_PASSWORD: 'admin'

For example when I try the compose file above, logging the container does show me that KEY and SECRET etc are present:

WindowsTerminal_dIS7HY8dkq

Alternatively you can also try the other slightly different syntax of setting environment variables (refer here: https://docs.docker.com/compose/compose-file/compose-file-v3/#environment) such as:

    environment:
      - KEY=255d861b-5ea1-5996-9aa3-922530ec40b1
      - SECRET=6116487b-cda1-52c2-b5b5-c8022c45e263
      - ADMIN_EMAIL=admin@admin.com
      - ADMIN_PASSWORD=admin

Closing this for now as I believe it's more so a docker-compose and/or compose file issue rather than a bug with Directus, but do let us know whether it's really a syntax issue here once you have the chance to confirm 👍

@swapbee
Copy link

swapbee commented Mar 18, 2022

image
Installed for the first time on the Ubuntu server. The issue exists outside docker too.

@azrikahar
Copy link
Contributor

Hmm I've also tried installing on a Ubuntu server (DO droplet) and it is still working fine on my end as seen here:

M1yeFqyIbD.mp4

so this may be tricky to find out what's happening on your (and OP) setup. Just to be sure, are you running npx directus start on the right directory?

@swapbee
Copy link

swapbee commented Mar 18, 2022

so this may be tricky to find out what's happening on your (and OP) setup. Just to be sure, are you running npx directus start on the right directory?

My bad. What you mentioned was the issue for me here. I had to cd into directory. Working fine now.

@azrikahar
Copy link
Contributor

Thanks for confirming! I've also just realized OP phrased it as 2 steps, docker-compose up -d and npx directus start. However this 2nd step shouldn't be run here after docker compose command 🤔 unless of course OP meant the command itself is erroring out INSIDE the container which was my initial interpretation.

@joelee2017
Copy link
Author

thx you are right. problem is from not right directory,

but now other new problem

Cannot read properties of undefined (reading 'primary')
image

@azrikahar
Copy link
Contributor

thx you are right. problem is from not right directory,

Thanks for confirming it's not an actual bug!

but now other new problem

Pardon my confusion here, but initially you did point out you were using docker-compose, however it seems like this is a local installation instead?

It also seems like all the log lines are show as ? ? which is rather odd in and of itself. With that said, assuming it is powershell (just a guess from the font & color), you can try following this and see does that help: #3217 (reply in thread)

As for the actual error you are seeing here, I would recommend opening a new issue detailing the steps you precisely did for your particular directus instance so that we can investigate further with more information at hand 👍

@joelee2017
Copy link
Author

Pardon my confusion here, but initially you did point out you were using docker-compose, however it seems like this is a local installation instead?

yes is local installation , I tried using the video method you provided above

It also seems like all the log lines are show as ? ? which is rather odd in and of itself. With that said, assuming it is powershell (just a guess from the font & color), you can try following this and see does that help: #3217 (reply in thread)

thx

As for the actual error you are seeing here, I would recommend opening a new issue detailing the steps you precisely did for your particular directus instance so that we can investigate further with more information at hand 👍

ok

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants