@TechCare-Aus opened this Issue on March 29th 2022

Went to setup another WordPress website and needed the Auth Token for the client.

Attempts to create the token end up with a spinning wheel and nothing until the web browser (Edge latest, tried Firefox too) displays 504 Gateway Timeout.

I haven't done this for some time and the rest of the website works fine as far as I can tell.

Any other details (e.g. nginx configs) let me know.

Also this issue seemed to be very similar to mine but I have got my system running latest 20.04 LTS. Restarted multiple times. No joy.

Expected Behavior

Display of Auth Token

Current Behavior

Gateway Timeout

Possible Solution

Unknown. Searched Forums, Google.

Steps to Reproduce (for Bugs)

  1. Navigate to Administration > Personal > Security > Auth Tokens > Create New Token
  2. Enter password
  3. Enter Name and click "Create New Token"

Relevant Logs

  • Nginx Error Log:
    2022/03/29 21:56:29 [error] 104979<a href='/104979'>#104979</a>: *173 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.1.1, server: matomo.example.com, request: "POST /index.php?module=UsersManager&action=addNewToken&idSite=1&period=day&date=today&activated= HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock", host: "matomo.example.com", referrer: "https://matomo.example.com/index.php?module=UsersManager&action=addNewToken&idSite=1&period=day&date=today&activated="

  • Nginx Access Log:
    192.168.1.1 - - [29/Mar/2022:22:01:50 +0800] "GET /index.php?module=Login&action=confirmPassword&idSite=1&period=day&date=today&activated= HTTP/2.0" 200 25491 "https://matomo.example.com/index.php?module=UsersManager&action=userSecurity&idSite=1&period=day&date=today&activated=" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55"
    192.168.1.1 - - [29/Mar/2022:22:01:50 +0800] "POST /index.php?date=today&module=API&format=json&method=API.getPagesComparisonsDisabledFor&segment=&idSite=1&period=day HTTP/2.0" 200 230 "https://matomo.example.com/index.php?module=Login&action=confirmPassword&idSite=1&period=day&date=today&activated=" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55"
    192.168.1.1 - - [29/Mar/2022:22:01:50 +0800] "GET /index.php?module=UsersManager&action=userSecurity&idSite=1&period=day&date=today&activated= HTTP/2.0" 200 32141 "https://matomo.example.com/index.php?module=UsersManager&action=userSecurity&idSite=1&period=day&date=today&activated=" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55"
    192.168.1.1 - - [29/Mar/2022:22:01:51 +0800] "POST /index.php?date=today&module=API&format=json&method=API.getPagesComparisonsDisabledFor&segment=&idSite=1&period=day HTTP/2.0" 200 230 "https://matomo.example.com/index.php?module=UsersManager&action=userSecurity&idSite=1&period=day&date=today&activated=" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55"
    192.168.1.1 - - [29/Mar/2022:22:01:53 +0800] "GET /index.php?module=UsersManager&action=addNewToken&idSite=1&period=day&date=today&activated= HTTP/2.0" 200 30476 "https://matomo.example.com/index.php?module=UsersManager&action=userSecurity&idSite=1&period=day&date=today&activated=" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55"
    192.168.1.1 - - [29/Mar/2022:22:01:54 +0800] "POST /index.php?date=today&module=API&format=json&method=API.getPagesComparisonsDisabledFor&segment=&idSite=1&period=day HTTP/2.0" 200 230 "https://matomo.example.com/index.php?module=UsersManager&action=addNewToken&idSite=1&period=day&date=today&activated=" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55"
    192.168.1.1 - - [29/Mar/2022:22:01:59 +0800] "POST /index.php?module=UsersManager&action=addNewToken&idSite=1&period=day&date=today&activated= HTTP/2.0" 499 0 "https://matomo.example.com/index.php?module=UsersManager&action=addNewToken&idSite=1&period=day&date=today&activated=" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55"
    192.168.1.1 - - [29/Mar/2022:22:02:59 +0800] "POST /index.php?module=UsersManager&action=addNewToken&idSite=1&period=day&date=today&activated= HTTP/2.0" 504 569 "https://matomo.example.com/index.php?module=UsersManager&action=addNewToken&idSite=1&period=day&date=today&activated=" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.74 Safari/537.36 Edg/99.0.1150.55"

  • PHP Error Log:
    Nothing

Your Environment

  • Matomo Version: 4.8
  • PHP Version: 7.3, 7.4, 8.1
  • Server Operating System: Ubuntu 20.04 LTS
  • Nginx 1.21.6
  • Additionally installed plugins: BotTracker (v2.07)
  • Browser: Edge 99.0.1150.55 (Official build) (64-bit), Firefox 98.0.2 (64-bit)
  • Operating System: Windows 11
@bx80 commented on March 31st 2022 Contributor

Hi @TechCare-Aus, thanks for reaching out.

Immediately after generating a user token Matomo will attempt to send the token details to the user in an email, once this email is sent then the 'token created successfully' view will be rendered.

So it's possible that something is causing the email send to hang long enough for the request to timeout.

It might be worth confirming that Matomo is able to send emails using the console command documented in this FAQ
or disable email sending temporarily by adding emails_enabled = 0 to the [General] section ofconfig/config.ini.php` and then trying the token generation again.

@TechCare-Aus commented on March 31st 2022

@bx80 - you sir are a legend. Exactly the cause of the issue. Thankyou.

I removed SMTP settings and it immediately worked.

Would be great to see an error message about that on the GUI.

"Error - Unable to send email. Check SMTP settings and try again"

@bx80 commented on March 31st 2022 Contributor

You're welcome :smiley:
I've created a new ticket so we can look at improving how things are handled when there is a mail configuration problem.

@utrenkner commented on May 13th 2022

Just experienced the exact same issue. Found the answer here (problem with SMTP configuration).

Thanks for pointing out the solution here - maybe, as a quick "fix", this info could be added to some FAQ?

@bx80 commented on May 17th 2022 Contributor
This Issue was closed on March 31st 2022
Powered by GitHub Issue Mirror