To debug my workflow I do “console.log(…)” in actions. How can I get these messages?
So far I found two ways, which don’t work for me:
Monitoring → Action Logs, but: it’s a real-time stream, I can’t get the messages from the past
Monitoring → Logs → Completed login operation → Details → Action Executions, but: because of some bug in the custom workflow (on my side, not yet reproduced), the operations don’t finish either successfully or with an error, so there is no entry in the logs
What kind of trigger are you using to log into the console?
Any console log should definitely be visible under the Action Executions tab. In the context of a PostLogin Trigger, it will be visible under the Successful Login log and it should look like this:
I get sporadic issues, sometimes the workflow breaks on my side between “sendUserTo” and “onContinuePostLogin”, so for Auth0 the workflow status is probably “hanging” rather than “successful” or “failed”, and the login event is not recorded. And if there is no event, then there is no its “action executions” tab.
After some testing, I noticed that you are redirecting the user during the onExecutePostLogin block. As mentioned in our documentation:
Actions will finish the execution of this Action, and then suspend the actions pipeline to send the user to the https://my-app.exampleco.com. In other words, any Actions that are bound to the post-login triggers that run after the Action invoking the redirect will not execute until the authentication flow has been resumed. If you are familiar with Redirect Rules, then note that this is a key difference between Redirect Actions and Redirect Rules.
From the information above, if you do not redirect the user back to the /continue endpoint, the authentication flow is never fully executed and any other code you have in the initial block will not complete, hence the console log not being visible in the logs (most probably because the Successful Login is also absent.
You can either redirect the user inside the onContinuePostLogin block in order for the console log to run or move any relevant code here after the authentication flow is being resumed. That fully depends on what you are looking to accomplish inside the Action, without seeing all the code, I cannot recommend a proper flow for your specific use case.
I’m debugging an existing flow like GDPR: Track Consent with Lock - Auth0 Docs , “Option 3: Redirect to another page”. The code on our side has to run before the flow is finished. Sometimes the flow is broken and I’m investigating why, and the information what was done in an action is important here.
Meanwhile I decided that an action will send debug messages to a log collector. Probably it’s actually the best solution.
Meanwhile I decided that an action will send debug messages to a log collector. Probably it’s actually the best solution.
This would be the best course of action since the redirect stops the console log from completing(however, it does run when using the real time Action Logs) until the user is redirected back as mentioned above. In other words, any code inside the trigger will be completed but for the logs to show the needed information, the user needs to be redirected back to the /continue endpoint.
Glad I could help and if you have any other questions, let me know!