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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report: The Msg91 OTP isn't working after the 1.5 upgrade #7823

Closed
2 tasks done
rohankm opened this issue Mar 13, 2024 · 4 comments
Closed
2 tasks done

馃悰 Bug Report: The Msg91 OTP isn't working after the 1.5 upgrade #7823

rohankm opened this issue Mar 13, 2024 · 4 comments
Assignees
Labels
bug Something isn't working product / messaging Fixes and upgrades for the Appwrite Messaging.

Comments

@rohankm
Copy link

rohankm commented Mar 13, 2024

馃憻 Reproduction steps

Hi,
I have set it up according to the docs https://appwrite.io/docs/advanced/self-hosting/sms
the OTP for login was working before the upgrade to 1.5

here are the appwrite-worker-messaging logs

Warning: Undefined array key "templateId" in /usr/src/code/src/Appwrite/Platform/Workers/Messaging.php on line 461
[Job] (65f19b7b27cfc0.65895609) failed to run.
[Job] (65f19b7b27cfc0.65895609) Utopia\Messaging\Adapter\SMS\Msg91::__construct(): Argument #3 ($templateId) must be of type string, null given, called in /usr/src/code/src/Appwrite/Platform/Workers/Messaging.php on line 461
[Error] Type: TypeError
[Error] Message: Utopia\Messaging\Adapter\SMS\Msg91::__construct(): Argument #3 ($templateId) must be of type string, null given, called in /usr/src/code/src/Appwrite/Platform/Workers/Messaging.php on line 461
[Error] File: /usr/src/code/vendor/utopia-php/messaging/src/Utopia/Messaging/Adapter/SMS/Msg91.php
[Error] Line: 21

馃憤 Expected behavior

it should send the otp

馃憥 Actual Behavior

Warning: Undefined array key "templateId" in /usr/src/code/src/Appwrite/Platform/Workers/Messaging.php on line 461
[Job] (65f19b7b27cfc0.65895609) failed to run.
[Job] (65f19b7b27cfc0.65895609) Utopia\Messaging\Adapter\SMS\Msg91::__construct(): Argument #3 ($templateId) must be of type string, null given, called in /usr/src/code/src/Appwrite/Platform/Workers/Messaging.php on line 461
[Error] Type: TypeError
[Error] Message: Utopia\Messaging\Adapter\SMS\Msg91::__construct(): Argument #3 ($templateId) must be of type string, null given, called in /usr/src/code/src/Appwrite/Platform/Workers/Messaging.php on line 461
[Error] File: /usr/src/code/vendor/utopia-php/messaging/src/Utopia/Messaging/Adapter/SMS/Msg91.php
[Error] Line: 21

馃幉 Appwrite version

Appwrite Cloud

馃捇 Operating system

Linux

馃П Your Environment

No response

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@rohankm rohankm added the bug Something isn't working label Mar 13, 2024
@stnguyen90 stnguyen90 added the product / messaging Fixes and upgrades for the Appwrite Messaging. label Mar 13, 2024
@stnguyen90
Copy link
Contributor

@rohankm, thanks for creating this! 馃檹馃徏 Looks like we need to:

  1. extract the templateId from the env var and set it here

MSG91 in the Messaging Providers is also broken. For that, we'll need to:

  1. Update the Create MSG91 endpoint to:
    • accept templateId as a param
    • add templateId to credentials
    • remove the from param
  2. Update the Update MSG91 endpoint to:
    • accept templateId as a param
    • add templateId to credentials
    • remove the from param
  3. Update the Console

@rohankm
Copy link
Author

rohankm commented Mar 13, 2024

@stnguyen90 temporary i manually set the keys here

'msg91' => new Msg91($credentials['senderId'], $credentials['authKey'], $credentials['templateId']),

I logged the messages being sent and it's like this 596853 is your myProject verification code.

for Msg91 especially in India there are specific variables set which cannot be exceeded certain length

here is the error message from Msg91

DLT Template variable exceeded max length

@rohankm
Copy link
Author

rohankm commented Mar 13, 2024

as a workaround for this i had to modify this line of code

$message = $message->setParam('{{token}}', $messageContent);

$message = $message->setParam('{{token}}', $secret);

@stnguyen90 stnguyen90 mentioned this issue Mar 15, 2024
2 tasks
@stnguyen90
Copy link
Contributor

DLT Template variable exceeded max length

Thanks for raising this! Looks like their FAQ says:

Q. What is the character limit in Variable {#var#} while sending SMS?

The actual value of the variable while sending an SMS will be maximum 30 characters, for English and Unicode both.

@stnguyen90 stnguyen90 self-assigned this Mar 20, 2024
stnguyen90 added a commit that referenced this issue Apr 3, 2024
Some providers have a limit on the length of the content. For example,
MSG91 has a 30 character limit and passing a longer value wil result
in an error:

     DLT Template variable exceeded max length

As such, we're going to change the content back to how we had it before
1.5 when were were only sending the code by itself until we decide on
a better solution.

Reference:

* #7823 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working product / messaging Fixes and upgrades for the Appwrite Messaging.
Projects
Status: Done
Development

No branches or pull requests

3 participants