Search code examples
appwritesms-verification

Appwrite SMS verification not send


Dear appwrite community,

I implemented a simple sms verification for my flutter app. When I want to send a verification sms via text-magic, the appwrite messaging worker log the following error.

[notice] Starting work on (Job{v1-messaging} | ID: e8dbb2e55c8e618a1e31179d42f9a22f | MessagingV1 | [{"project":null,"user":null,"payload":[],"recipient":"+123456789","message":"123456","events":["."]}])
[critical] (Job{v1-messaging} | ID: e8dbb2e55c8e618a1e31179d42f9a22f | MessagingV1 | [{"project":null,"user":null,"payload":[],"recipient":"+123456789","message":"123456","events":["."]}]) has failed TypeError: strlen(): Argument #1 ($str) must be of type string, array given in /usr/src/code/vendor/utopia-php/messaging/src/Utopia/Messaging/Adapter.php:59
Stack trace:
#0 /usr/src/code/vendor/utopia-php/messaging/src/Utopia/Messaging/Adapters/SMS/TextMagic.php(54): Utopia\Messaging\Adapter->request('POST', 'https://rest.te...', Array, Array)
#1 /usr/src/code/vendor/utopia-php/messaging/src/Utopia/Messaging/Adapters/SMS.php(33): Utopia\Messaging\Adapters\SMS\TextMagic->process(Object(Utopia\Messaging\Messages\SMS))
#2 /usr/src/code/app/workers/messaging.php(69): Utopia\Messaging\Adapters\SMS->send(Object(Utopia\Messaging\Messages\SMS))
#3 /usr/src/code/src/Appwrite/Resque/Worker.php(121): MessagingV1->run()
#4 /usr/src/code/vendor/resque/php-resque/lib/Resque/Job.php(201): Appwrite\Resque\Worker->perform()
#5 /usr/src/code/vendor/resque/php-resque/lib/Resque/Worker.php(303): Resque_Job->perform()
#6 /usr/src/code/vendor/resque/php-resque/lib/Resque/Worker.php(242): Resque_Worker->perform(Object(Resque_Job))
#7 /usr/src/code/vendor/resque/php-resque/bin/resque(185): Resque_Worker->work('1', false)
#8 {main}

There is no sms send, but the user is created in my appwrite console. I've setup the phoneSession like this.

startPhoneSession(String phone) async {
    try {
      _user ??= User();
      if (account == null) {
        _init();
      }
      var token =
          await account!.createPhoneSession(userId: ID.unique(), phone: phone);
      _user!.id = token.userId;
      _storeUserId();
    } catch (error) {
      //Do something with the error...
      print(error);
    }
  }

My .env variables are set like the docs say with the username and apikey from text-magic.

It feels like a issue with appwrite right? If you need anymore information feel free to ask :)

Cheers!


Solution

  • This does look like it might be a bug. The best place to report bugs would be Appwrite's GitHub repo. I would suggest creating an issue there.