Then a link (including this insert_identity and a UUID as url parameters) are send to user email.
I have completed everything successfully (mailer setup, DB insert etc) but the SC form is returning an error event AND NO SUCCESS EVENT.
The reason I call it SUCCESSFULL is because :
a) the DB insert is made and the email is sent (and of course the email is received from the recipient)
b) I get a 200 response
The SC Form lastError.status is 0 and the lastError.message is “Response as not a valid JSON”
Wappler Version : 5.4.0
Operating System : wndows
Server Model: php
Database :MariaDB
Anybody could give me a help on what this message means would be great!
So what do the status and message return actually?
You can check after the server action runs in the browser console typing: dmx.app.data and expand the server action properties. You will see the exact status and message under lastError:
I see in the very first screenshot of the topic that you have a Response 200 in the Catch. Do you also return valid JSON in that Response step? The error that you get is when the response from the server did not contain any valid JSON, even with a 200 response it will throw this error.
Thanks for applying.
I am not good on all of these checkings (that’s why I loved Wappler).
The Response 200 step was just a last minute try…
The problem started when although the form was submitted successfully and the email received from the recipient.
First I removed the send email step to understand where the error was coming from and there was no error! When I added back again the email step the error appeared again.
There is a lastError with status "0’ and message “Response was not valid JSON” (what that JSON should contain?)
And the Success Event never triggered although the whole action was completed successfully (checks, DB insert, last_insert.identity AND send email)…
I would say that I could “solve” it if I add a try/catch checking status 0 and avoid the error notification (crazy?)
Do you really need the try/catch?
You can just place send mail in the body of the API action. In the event of an error it ill return a status 500 (error) automatically
That is the way I had it initially…
After the DB insert I was sending an email with a link containing the last_instert.indentity and a code as url parameters…
(eg register.php?id=xx&code=xxxxxxxxx)
From the start I had no try/catch steps in the api action and dynamic events set on the SC form (error & success notifications).
On the first test I did, the form showed an error notification. While I was searching to see what the error could be, the email was received in my email inbox…
Could you check the response body in DevTools, I think it will be empty. You can also remove the Response step in the Catch, having the try/catch without any steps in the catch is enough to ignore the error.
Sorry for the trouble I caused guys…
My problem is solved
10 minutes ago, I had to restart my laptop for windows updates.
When update has been completed, I restarted Wappler and I had an update, guess what… PHPMailer