Could not authenticate when APP_DEBUG="false" (all apps)
When I set .env variable APP_DEBUG to false it stops accepting any logins.
Everything works just fine with APP_DEBUG set to true.
My .env
APP_TENANT_ID=# ID
APP_PROJECT_KEY=# key
APP_URL="http://..."
APP_APPS_URL="http://..."
APP_ENV=prod
APP_DEBUG=false
APP_CONNECTION=# DB connection
APP_MAILER=# Mailer config
APP_MESSENGER="doctrine://default"
APP_MAIL_SENDER=# Sender
APP_MARKETPLACE="on"
Could you show me the response of the XHR request of the login or also the error logs to see whether there is a specific error. In general in debug mode many caches are disabled.
I relised that the whole api crashes when debug is off so the webapp admin can't even contact the api. (I get white site indicating that PHP crashed mid generation)
Ok, do you have any errors in the default PHP error log? You can also take a look at the log/app.log file. Maybe there are simply some file permission errors.
Here is the log app.log
So in your .env file thre is no APP_CONNECTION configured, you need to set there the fitting DB connection s. https://github.com/apioo/fusio/blob/master/.env#L7 the error also indicated this SQLSTATE[HY000] [2002] No such file or directory
I do have that set. I can normaly connect to the db in debug mode.
Here is the APP_CONNECTION variable (censured for security)
I recently had a similar issue on a shared hosting Linux dist I thought maybe it's a cache problem and I tried:
composer clear-cache
composer dump-autoload
composer dump-autoload -o
Because I had no access so the server SSH I could execute these via exec.
It's a scary way and make sure to delete this file after anyone uses it, but I needed a fast way to send commands.
<?php
$output=null;
$result=null;
//exec('composer clear-cache', $output, $result);
//exec('composer dump-autoload', $output, $result);
//exec('composer clearcache', $output, $result);
//exec('composer dump-autoload -o', $output, $result);
exec('composer', $output, $result);
echo json_encode(
array(
'data' =>
array(
'result' => $result,
),
'reply' => $output
)
);
?>
Still had an issue....
Then I remembered it's not Laravel perhaps it's something like: it points to .env.local for local etc.
Renaming the file did nothing....
Then opening the file to see if there was some weird string or something I noticed if you put a # comment on the same line the file fails to load.... switching to comments on the line above fixed the issue.... Wow what a frustrating thing but yeah just a simple error... easy to forget that
Posting this here for future reference.
Hopefully it helps someone in future.
Example of fix (in my case)
Fails to load # comment on same line
APP_TENANT_ID=""
APP_PROJECT_KEY="23b765c92fcd51c6772d4b00339c82ff"
APP_URL="http://127.0.0.1/fusio/public"
APP_APPS_URL="http://127.0.0.1/fusio/public/apps"
APP_ENV="prod" #dev or prod
APP_DEBUG="false" #true or false
APP_CONNECTION="pdo-mysql://root:@localhost/fusio_db"
APP_MAILER="native://default"
APP_MESSENGER="doctrine://default"
APP_MAIL_SENDER=""
SDKGEN_CLIENT_ID=""
SDKGEN_CLIENT_SECRET=""
Works # comment on line above
APP_TENANT_ID=""
APP_PROJECT_KEY="23b765c92fcd51c6772d4b00339c82ff"
APP_URL="http://127.0.0.1/fusio/public"
APP_APPS_URL="http://127.0.0.1/fusio/public/apps"
# dev or prod
APP_ENV="prod"
# true or false
APP_DEBUG="false"
APP_CONNECTION="pdo-mysql://root:@localhost/fusio_db"
APP_MAILER="native://default"
APP_MESSENGER="doctrine://default"
APP_MAIL_SENDER=""
SDKGEN_CLIENT_ID=""
SDKGEN_CLIENT_SECRET=""
@Cale-Torino ok, I have also just added a commit to change the comment s. https://github.com/apioo/fusio/commit/155ec8557c1b14fcc264c344d85255100a43d711