API Call return : {"error":{"code":3,"message":"Unauthorized request"}}
Command run without errors
direkt API Call and php bin/directus install:install commands retruns
Fatal error: Uncaught Error: Only variables can be passed by reference in /var/www/src/core/Directus/Config/Context.php:39 Stack trace: #0 /var/www/src/core/Directus/Config/Context.php(39): Directus\Config\Context::expand('tcp://mysql:330...', Array, 'tcp://mysql:330...') #1 /var/www/src/core/Directus/Config/Context.php(39): Directus\Config\Context::expand(Array, Array, 'tcp://mysql:330...') #2 /var/www/src/core/Directus/Config/Context.php(39): Directus\Config\Context::expand(Array, Array, 'tcp://mysql:330...') #3 /var/www/src/core/Directus/Config/Context.php(39): Directus\Config\Context::expand(Array, Array, 'tcp://mysql:330...') #4 /var/www/src/core/Directus/Config/Context.php(71): Directus\Config\Context::expand(Array, Array, 'tcp://mysql:330...') #5 /var/www/src/core/Directus/Config/Context.php(85): Directus\Config\Context::from_map(Array) #6 /var/www/src/web.php(30): Directus\Config\Context::from_env() #7 /var/www/public/index.php(3): require('/var/www/src/we...') #8 {main} thrown in /var/www/src/core/Directus/Config/Context.php on line 39
mysql config is correct
We do not provide containers for directus suite, only api and app containers separately.
As your current setup is not supported by the team (we do have separate images for api and app, and mounting the suite inside a container, for now is undefined behavior), it's really hard to say what is going on.
May I ask for the complete docker-compose file so I can take a quick look?
@WoLfulus — would you say this should be transferred to the docker repo, or stay here for now?
Even though this is a different setup than we support, this is the second time I see this specific error and I think it might be something in the api that broke in the latest release. Haven't had enough time to take a look into it. It would be nice if @directus/api-team try to reproduce this error and see what is causing it, but I'm almost sure it has nothing to do with docker.
@WoLfulus i think its an API Error, the same Docker Image runs fine on my local machine
That's what I thought.
@directus/api-team 🔔
Hey @KartoffelToby! We really appreciate you taking the time to report an issue.
@WoLfulus - I'll check it and provide an update soon :)
Hahaha, wait... who's in charge of this one? I think they're saying it's an API issue, @bjgajjar
@benhaynes - Yeah. That's why I asked for some time to check the issue. I'll provide the feedback once go through it :)
To be clear, i reproduced this Error locally:
ERROR Test docker-compose file:
version: "2"
services:
#
# Database
#
mysql:
image: mysql:8
command: --default-authentication-plugin=mysql_native_password
#network_mode: "bridge"
environment:
MYSQL_DATABASE: "directus"
MYSQL_USER: "directus"
MYSQL_PASSWORD: "directus"
MYSQL_ROOT_PASSWORD: "directus"
#
# API instance.
# This should serve our api requests and won't work before database
# is properly installed by running the installer.
#
api:
image: directus/api:v2-apache
#network_mode: "bridge"
environment:
# App
DIRECTUS_APP_ENV: "production"
DIRECTUS_APP_TIMEZONE: "Europe/Berlin"
# These are now required, make sure to always set
# to something unique while in production
DIRECTUS_AUTH_PUBLICKEY: "3HEUBnxXP6y8NLH2T147aQ5WZFSKS"
DIRECTUS_AUTH_SECRETKEY: "2H9LTER73U60iWhI4KBN5aLZNFKOCK9"
# Database
DIRECTUS_DATABASE_HOST: "mysql"
DIRECTUS_DATABASE_PORT: "3306"
DIRECTUS_DATABASE_NAME: "directus"
DIRECTUS_DATABASE_USERNAME: "directus"
DIRECTUS_DATABASE_PASSWORD: "directus"
links:
- mysql:mysql
#
# APP instance.
# This is our graphical management interface.
#
app:
image: directus/app:v7-node
#network_mode: "bridge"
environment:
DIRECTUS_APP_TITLE: "DEMO"
DIRECTUS_APP_URL: https://api.demo.de/_/
This docker compose file works, but if you uncomment the network_mode: "bridge" so the containers run in a other network the Error:
Fatal error: Uncaught Error: Only variables can be passed by reference in /var/www/src/core/Directus/Config/Context.php:39 Stack trace: #0 /var/www/src/core/Directus/Config/Context.php(39): Directus\Config\Context::expand('tcp://mysql:330...', Array, 'tcp://mysql:330...') #1 /var/www/src/core/Directus/Config/Context.php(39): Directus\Config\Context::expand(Array, Array, 'tcp://mysql:330...') #2 /var/www/src/core/Directus/Config/Context.php(39): Directus\Config\Context::expand(Array, Array, 'tcp://mysql:330...') #3 /var/www/src/core/Directus/Config/Context.php(39): Directus\Config\Context::expand(Array, Array, 'tcp://mysql:330...') #4 /var/www/src/core/Directus/Config/Context.php(71): Directus\Config\Context::expand(Array, Array, 'tcp://mysql:330...') #5 /var/www/src/core/Directus/Config/Context.php(85): Directus\Config\Context::from_map(Array) #6 /var/www/src/web.php(30): Directus\Config\Context::from_env() #7 /var/www/public/index.php(3): require('/var/www/src/we...') #8 {main} thrown in /var/www/src/core/Directus/Config/Context.php on line 39
Fired from API, maby some Network request errors here that pick up the wrong context.
@KartoffelToby - Thanks for helping us in debugging the issue. We appreciate your efforts. :)
Whoops! My phone screen is too small and I didn't see the hyphen! Looked like you said wolfulus will check and provide update 😊
I tried to install the directus using the command line and it works as expected. Below are the steps to confirm whether its an issue of API or not.
php bin/directus install:database -N _php bin/directus install:install -e [email protected] -p password -t _ -N _I was able to install directus successfully.
Kindly point out if I am missing any steps.
@bjgajjar In the Docker Container with the bridge network mode?
Please see issue 1337, I believe these two issues are related.
To verify, go into Docker container and type env to see if it has similar nested environment variables.
Docker Container with the bridge network mode
No - I just need to check for the API. Thus, I tried to check it without Docker; which works smoothly. I already mentioned the steps which I followed to replicate the issue.
@WoLfulus - Can you please check with the Docker. Though @KartoffelToby confirms that this issue does not persist for the latest image; It would be great if we get the confirmation from you too.
I've the same problem with the directus/api:latest image running on kubernetes.
It also occurs with v2.5.0-apache. 2.0.18 image is ok.
the image is broken...
u can reproduce the error just by setting the public and private key and nothing else.
i setup the container on rancher. but with no settings. just the image and the public and private key as env variables.
@bjgajjar this should have been fixed in #1347 I think
Got a confirmation from @WoLfulus - this issue is not reproduce now. So closing this.
Most helpful comment
To be clear, i reproduced this Error locally:
ERROR Test docker-compose file:
This docker compose file works, but if you uncomment the network_mode: "bridge" so the containers run in a other network the Error:
Fatal error: Uncaught Error: Only variables can be passed by reference in /var/www/src/core/Directus/Config/Context.php:39 Stack trace: #0 /var/www/src/core/Directus/Config/Context.php(39): Directus\Config\Context::expand('tcp://mysql:330...', Array, 'tcp://mysql:330...') #1 /var/www/src/core/Directus/Config/Context.php(39): Directus\Config\Context::expand(Array, Array, 'tcp://mysql:330...') #2 /var/www/src/core/Directus/Config/Context.php(39): Directus\Config\Context::expand(Array, Array, 'tcp://mysql:330...') #3 /var/www/src/core/Directus/Config/Context.php(39): Directus\Config\Context::expand(Array, Array, 'tcp://mysql:330...') #4 /var/www/src/core/Directus/Config/Context.php(71): Directus\Config\Context::expand(Array, Array, 'tcp://mysql:330...') #5 /var/www/src/core/Directus/Config/Context.php(85): Directus\Config\Context::from_map(Array) #6 /var/www/src/web.php(30): Directus\Config\Context::from_env() #7 /var/www/public/index.php(3): require('/var/www/src/we...') #8 {main} thrown in /var/www/src/core/Directus/Config/Context.php on line 39Fired from API, maby some Network request errors here that pick up the wrong context.