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

Clear the cached config file after writing to the .env file #4261

Closed
wants to merge 2 commits into from

Conversation

pavog
Copy link
Contributor

@pavog pavog commented Apr 9, 2021

This clears the cached config file so that the application loads the new settings from the freshly written .env file.
The command handler writes the new mail settings into the .env file but they are not loaded if the config is cached.

This fixes #4260

@athornfam2
Copy link

I saw that you linked my SMTP Issue from #47.

  • I ran cp UpdateConfigCommandHandler.php UpdateConfigCommandHandler1.php
  • Edited the UpdateConfigCommandHandler.php with the raw file... basically a ctrl + k to delete all info and then paste the raw file - save
  • I'm getting an error internal 500 error with the changes made

@pavog
Copy link
Contributor Author

pavog commented Apr 29, 2021

Hello, I assume you mean the issue #47 of fiveai/Cachet ;-)

The steps you describe are the same ones I did. Of course, I tested the changes on my system before opening the pr.

To help me reproduce the error you are getting, please tell me:
When do you get the 500? When you click the "Save" button for the email settings in your dashboard?
The error code alone doesn't help me much. Can you check if you have a more detailed error message for me? Maybe there is one in your php_errors.log file or in the laravel.log in storage/logs.

@athornfam2
Copy link

@pavog

Hello and yes, sir.

`[2021-03-24 12:38:08] production.NOTICE: Symfony\Component\HttpKernel\Exception\HttpException in /var/www/html/cachet/app/Http/Middleware/Authenticate.php:58
Stack trace:
#0 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): CachetHQ\Cachet\Http\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#1 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#2 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#3 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#4 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#5 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(75): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#6 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#7 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#8 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#9 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#10 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#11 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#12 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#13 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#14 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#15 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#16 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#17 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(66): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#18 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#19 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#20 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#21 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Router.php(684): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#22 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Router.php(659): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#23 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Router.php(625): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#24 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Router.php(614): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#25 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#26 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))
#27 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request$
#28 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#30 /var/www/html/cachet/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#31 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#32 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#33 /var/www/html/cachet/vendor/barryvdh/laravel-cors/src/HandlePreflight.php(29): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#34 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): Barryvdh\Cors\HandlePreflight->handle(Object(Illuminate\Http\Request), Object(Closure))
#35 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#36 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#37 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#38 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#39 /var/www/html/cachet/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#40 {main} {"identification":{"id":"10164db8-affb-4d6c-ad6b-512e3e36ff1a"},"exception":"[object] (Symfony\Component\HttpKernel\Exception\HttpException(code: 0): at /var/www/html/cachet/app/Http/Middleware/Aut$
[stacktrace]
#0 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(163): CachetHQ\Cachet\Http\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#1 /var/www/html/cachet/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))'

No log file other than laravel when I ran this command find -L /var/www/html/cachet -name "*.log"

@pavog
Copy link
Contributor Author

pavog commented Apr 29, 2021

Mhh it seems that this error occurs because the Authenticate Middleware thinks you are a guest user.
I don't know why this is, it seems to be a problem with Laravel and not with Cachet's application code.
I can't say anything more specific about this error. It works for me and I can not reproduce it.

Please try the following and try setting the email settings again after each step:

  • Log out, delete all cookies and log back in
  • Try using a different browser
  • Try using an incognito tab
  • Try using a different user

@jbrooksuk
Copy link
Member

Thank you for your input on Cachet 2.x. We are shifting our attention and resources to Cachet 3.x and will no longer be supporting the 2.x version. If your feedback or issue is relevant to the 3.x series, we encourage you to engage with the new branch.

For more information on the Cachet rebuild and our plans for 3.x, you can read the announcement here.

We appreciate your understanding and look forward to your contributions to the new version.

@jbrooksuk jbrooksuk closed this Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Email settings can't be changed
3 participants