YunoHost-Apps / firefly-iii-di_ynh

Firefly-III Data Importer packager for YunoHost
https://docs.firefly-iii.org/data-importer/
GNU General Public License v3.0
3 stars 7 forks source link

Error while connecting to Firefly #5

Closed Delegator9176 closed 1 year ago

Delegator9176 commented 1 year ago

Hello,

I'm facing an error while trying to use the Importer with my selfhosted Firefly-instance. I try to connect via the public URL, after that I get the following error:

Server error: POST https://your.domain.tls/firefly/oauth/token resulted in a 500 Internal Server Error response: <!DOCTYPE html> <html lang="de"> <head> <meta charset="UTF-8"> <meta name="robots" content="noindex, nofollow, n (truncated...)

I had a look at the official repository, there were also issues with the same error, but they all got fixed some versions ago, so I think it is related to the yunohost app.

If I can provide additional information please feel free :)

Thanks in advance

marcoil commented 1 year ago

Hi! If your Firefly instance is also hosted with Yunohost, can you check that it is enabled for all visitors? If you go to its URL in a browser private session, you should see Firefly's user login page, not Yunohost's page.

Setting Firefly to allow all visitors is necessary for the importer to access it, it's not a security problem because Firefly controls access itself.

Delegator9176 commented 1 year ago

The settings via the application menu are: image

also if I connect to my firefly instance via tor there is no redirect to the yunohost sso

marcoil commented 1 year ago

That seems correct. Is what you pasted the whole error message? Seeing what was truncated would really help.

Delegator9176 commented 1 year ago

Okay - can you give me some guidance here? On which application the importer or firefly ??

marcoil commented 1 year ago

Okay - can you give me some guidance here? On which application the importer or firefly ??

Sorry I wasn't more explicit. In your initial report, there's a server error message, but it ends with (truncated...). Do you see any way of getting the full error message?

Also, if you can go into your importer log directory (it's usually at /var/www/firefly-iii-di/storage/logs), get the log with the error and paste it here or upload it somewhere, it'd be really helpful.

hazzamyman commented 1 year ago

I've been having the same issues - same error - word for word. here are my logs:

[2023-05-08 14:11:13] local.ERROR: Client exception when decoding response: Server error: POST https://firefly.YUNOHOSTDOMAIN/oauth/token resulted in a 500 Internal Server Error response: <!DOCTYPE html>

Firefly III Exception :(

Whoops! An error occurred.

Unfortunately, this error was not recoverable :(. Firefly III broke. The error is:

Expected response code "250/251/252" but got code "553", with message "553 5.7.1 <email@YUNOHOSTDOMAIN>: Sender address rejected: not logged in".

This error occured in file /var/www/firefly-iii/app/Jobs/MailError.php on line 103 with code 0.

marcoil commented 1 year ago

I'm pretty sure that's the same error you get when Firefly is behind Yunohost's user login system, which makes it impossible for the importer to connect to it.

Are both Firefly and the importer in the same machine? Can you make sure that your importer points to Firefly's public URL? If you give it an internal name like localhost or 127.0.0.1 it won't work.

OnlyVoidd commented 1 year ago

Hello,

I have about the same error when trying to connect the Data Importer to my Self hosted Yunohost Firefly instance (which is on the same machine).

Here is the message :

Whoops! 500 :(

Sorry, the Firefly III Data Importer broke down.

Error message

The "state" returned from your server doesn't match the state that was sent.

More information

The error occurred in /var/www/firefly-iii-di/app/Http/Controllers/TokenController.php:74.

Here is the error in the logs :

[2023-05-18 18:43:52] local.ERROR: State according to session: "" [2023-05-18 18:43:52] local.ERROR: State returned in request : "18z3OuVumKg7SjwSkDLbE80alahhob4nAy38bKjf" [2023-05-18 18:43:52] local.ERROR: The "state" returned from your server doesn't match the state that was sent.

Followed by the stacktrace of the error.

I made sure the the Firefly URL is the public one and that I've put the correct client ID. Both Firefly and Data Importer are accessible by public users.

marcoil commented 1 year ago

I don't think it's the same error, the original one was 500 and mentioned login issues. There's an upstream discussion (and some closed issues) about the "state returned from your server doesn't match" error at https://github.com/orgs/firefly-iii/discussions/6069 .

To me it seems like the address that the importer is using to connect to Firefly isn't the publicly available one, but as the discussion says it could also be a cookie problem. I'll keep an eye on that discussion, but don't hesitate to add more questions/info here!

Delegator9176 commented 1 year ago

I tried again today and here are the logs - I replaced the domain name and the user name ... shall I also post the content of the MailError.php ??

2023-05-24 11:27:03] local.ERROR: Client exception when decoding response: Server error: `POST https://domain.tld/firefly/oauth/token` resulted in a `500 Internal Server Error` response:
<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="robots" content="noindex, nofollow, n (truncated...)

[2023-05-24 11:27:03] local.ERROR: Response from server: "<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="robots" content="noindex, nofollow, noarchive, noodp, NoImageIndex, noydir">
    <title>Firefly III Exception :(</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <base href="https://domain.tld/firefly/">

        <link href="v1/lib/bs/css/bootstrap.min.css?v=" rel="stylesheet" type="text/css" nonce="Ecj/z76zk8GqHSgUHNa2JA==">
    <link href="v1/lib/fa/css/font-awesome.min.css?v=" rel="stylesheet" type="text/css" nonce="Ecj/z76zk8GqHSgUHNa2JA==">
    <link href="v1/css/daterangepicker.css?v=" rel="stylesheet" type="text/css" nonce="Ecj/z76zk8GqHSgUHNa2JA==">

        <link href="v1/lib/adminlte/css/AdminLTE.min.css?v=" rel="stylesheet" type="text/css" nonce="Ecj/z76zk8GqHSgUHNa2JA==">
    <link href="v1/lib/adminlte/css/skins/skin-blue-light.min.css?v=" rel="stylesheet" type="text/css" nonce="Ecj/z76zk8GqHSgUHNa2JA==">

        <link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png?v=3e8AboOwbd">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png?v=3e8AboOwbd">
<link rel="manifest" href="manifest.webmanifest?v=3e8AboOwbd">
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#3c8dbc">
<link rel="shortcut icon" href="favicon.ico?v=3e8AboOwbd">
<meta name="apple-mobile-web-app-title" content="Firefly III">
<meta name="application-name" content="Firefly III">
<meta name="msapplication-TileColor" content="#3c8dbc">
<meta name="msapplication-TileImage" content="mstile-144x144.png?v=3e8AboOwbd">
<meta name="theme-color" content="#3c8dbc">

<script type="text/javascript" src="/ynh_portal.js"></script><link type="text/css" rel="stylesheet" href="/ynh_overlay.css"><script type="text/javascript" src="/ynhtheme/custom_portal.js"></script><link type="text/css" rel="stylesheet" href="/ynhtheme/custom_overlay.css"></head>
<body class="container">
<div class="row">
    <div class="col-lg-10 col-lg-offset-1 col-md-12 col-sm-12 col-xs-12">
        <h1><a href="https://domain.tld/firefly"><strong>Firefly</strong>III</a></h1>
    </div>
</div>
<div class="row">
    <div class="col-lg-10 col-lg-offset-1 col-md-12 col-sm-12 col-xs-12">
        <h3 class="text-info">Hoppla! Ein Fehler ist aufgetreten.</h3>
    </div>
</div>
<div class="row">
    <div class="col-lg-10 col-lg-offset-1 col-md-12 col-sm-12 col-xs-12">
        <p>
            Leider konnte dieser Fehler nicht wiederhergestellt werden :(. Firefly III ist kaputt. Der Fehler ist:
        </p>
        <p class="text-danger">
            Expected response code &quot;250/251/252&quot; but got code &quot;553&quot;, with message &quot;553 5.7.1 &lt;user@domain.tld&gt;: Sender address rejected: not logged in&quot;.
        </p>
        <p>
            Dieser Fehler ist in der Datei <span style="font-family: monospace;">/var/www/firefly-iii/app/Jobs/MailError.php</span> in Zeile 103 mit dem Code 0 aufgetreten.
        </p>
    </div>
</div>
    <div class="row">
        <div class="col-lg-10 col-lg-offset-1 col-md-12 col-sm-12 col-xs-12">
            <h4>
                Weitere Informationen
            </h4>
            <p>
                Bitte sammeln Sie weitere Informationen im Verzeichnis <code>storage/logs</code> wo Sie Logdateien finden können. Wenn Sie Docker verwenden, verwenden Sie <code>docker logs -f [container]</code>.
                Lesen Sie mehr über das Sammeln von Fehlerinformationen in <a href="https://docs.firefly-iii.org/faq/other#how-do-i-enable-debug-mode">der FAQ</a>.
            </p>
</body>
</html>
pjpmosteiro commented 1 year ago

The issue is with the way Firefly handles e-mail sending. When loggin in from FIDI or similar, it tries to send a email, but it does not authenticate well with Yunohost´s Postfix and get rejected.

Changing 'default' on /var/www/firefly-iii/config/mail.php to "=> 'log' "should solve the issue for now.

image

image

marcoil commented 1 year ago

The issue is with the way Firefly handles e-mail sending. When loggin in from FIDI or similar, it tries to send a email, but it does not authenticate well with Yunohost´s Postfix and get rejected.

I would have never caught that, thanks so much! Closing for now, but if someone's still having issues feel free to reopen.