Closed A-linea closed 2 days ago
Small update I tried to dig deeper as much as I could, wrote down the data in an html file what was happening in Guzzle inside /vendor/Guzzle and this is the response that crm receives from mailer, and that's why everything is falling down
Well, it was due to indentation, after the fix I get the following response that the mailer receives from sso
UPD:
Hi Peter, in order to make sure where exactly the problem is occurring, I followed the whole chain to /var/www/remp/Sso/app/Http/Controllers/AuthController.php
and found out that it receives the token and sends a response, but it takes a very long time. The problem itself occurs in /var/www/remp/Mailer/vendor/remp/mailer-module/src/Models/Sso/Client.php
on line 73. This is where the token gets instantly. Something wrong since the request from Guzzle.
I tested in three variants.
return true
from /var/www/remp/Mailer/vendor/remp/mailer-module/src/Models/Sso/Client.php
validToken():bool
this method sends a response instantly.1) This is very weird, SSO is basically an empty Laravel application with a very basic feature-set. The gateway timeout could possibly occur in Docker if you put your computer to sleep and then woke up. Something with the Docker's network isn't right (or maybe we have something wrongly configured) and the containers don't see each other correctly.
2) Since you use CRM, you did right by uncommenting CRM's IUser
interface implementation. The idea is that Mailer needs primary source of users. By default, it's provided by Dummy
implementation which only contains two users. Linking it to CRM is a good idea.
For now, make sure that crm_press_api_token
that you entered in Mailer's .env
file has full set of API rights. Each API key needs to have the API endpoints it can access enabled manually. You can find it in the CRM - API - Api access menu.
3) Empty mail set is OK, unless you already created some emails in Mailer or seeded them with make install-demo
. Also, the CRM doesn't request every email in Mailer, but (by default) only emails in the system
or system_optional
mail categories. You don't want your weekly newsletters to appear in scenarios, you only want your transactional (system) emails there.
4) Regarding slow SSO response - you can try to bypass that for now by configuring Mailer not to use SSO to verify that API key is valid, but to resolve that locally. Add this to your config.neon
or config.local.neon
:
services:
apiTokenRepository:
factory: Tomaj\NetteApi\Misc\StaticTokenRepository(['your_custom_secret': '*'])
If there is an API request with Authorization: Bearer your_custom_secret
, Mailer will accept that as valid.
Thanks for your response.
In the docker + crm-skeleton remp repository + crm-skeleton without a docker, installed and configured manually. Separately mailer-skeleton, crm-skeleton sso. Also for exapmle if I return simple return true from /var/www/remp/Mailer/vendor/remp/mailer-module/src/Models/Sso/Client.php validToken():bool this method sends a response instantly. Also the check-token endpoint works instantly if I send a request from Postman
and then I can add templates with this key to Mailer.
4.Hmm do I understand correctly that this will solve the token issue for Mailer, and I can use SSO for other modules (Beam, Segments, etc.) But Mailer will no longer send token verification to SSO module?
Also Peter Your help is very important to us. I really appreciate it. I have one more request for you! Please, I need help with the Beam installation process. If it is possible, please write me a "Hello" to the email address indicated in my profile so that I don't create a bunch of issues. Thank you very much!
Good afternoon!
My workflow crm-skeleton mailer-skeleton remp sso which generates a token for Mailer Everything is set up according to the documentation As an example.
mailer-skeleton config.neon
mailer-skeleton .env
crm-skeleton config.neon
I've encountered a strange behaviour, when I create a new scenario in crm-skeleton it pulls all the segments and everything seems to be ok, but after I save and edit this scenario, it is infinite loading. As you can see on the screenshot. With 504 errors. In the log, we see the following
I triggered this endpoint by Postman If I pass the api_key for the crm_skeleton, it works and I see expected response, but when I pass api_key for the mailer-skeleton, it does not.
On the other hand, if I comment out the line in
CRM_ADDR
CRM_API_TOKEN
then everything is loaded on the scripts page in crm-skeleton, but then the mailer itself does not work accordingly because it needs this data.
Please, tell me what is wrong with my settings?
And one more question: when I request mailer-template-list from Postman, I get an empty array, where should I look? As I can see from the database, they related also to mail_type_category, maybe i need additional param for category. I mean, when I want to select crm-skeleton -> actions->sendEmail in the scenario, there is nothing. How to bind mail templates, from mailer to crm.
Thank you!