OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Firebase SMS verification failing with error code 39

  • Thread starter Thread starter George O
  • Start date Start date
G

George O

Guest
I'm experiencing an issue with Firebase where SMS verification codes are not sent to some valid phone numbers. These numbers are able to receive SMS from other providers without any issues. The problem has been observed over multiple attempts on different days. Here are the details:

Code:
{
  "insertId": "-k92yxdd8v6y",
  "jsonPayload": {
    "@type": "type.googleapis.com/google.cloud.identitytoolkit.logging.RequestLog",
    "methodName": "google.cloud.identitytoolkit.v1.AuthenticationService.SendVerificationCode",
    "status": {
      "message": "Error code: 39",
      "code": 13
    },
    "request": {
      "@type": "type.googleapis.com/google.cloud.identitytoolkit.v1.SendVerificationCodeRequest",
      "phoneNumber": "+400730679600"
    },
    "requestMetadata": {
      "callerIp": "86.124.126.97",
      "callerSuppliedUserAgent": "FirebaseAuth.iOS/10.22.0 ro.afooddeployments.afood/3.4.0 iPhone/17.4.1 hw/iPhone14_5,gzip(gfe),gzip(gfe)"
    },
    "serviceName": "identitytoolkit.googleapis.com"
  },
  "resource": {
    "type": "identitytoolkit_project",
    "labels": {
      "project_id": "ambrosia-e5ea3"
    }
  },
  "timestamp": "2024-06-17T08:49:19.981Z",
  "severity": "ERROR",
  "logName": "projects/ambrosia-e5ea3/logs/identitytoolkit.googleapis.com%2Frequests",
  "receiveTimestamp": "2024-06-17T08:49:20.859697728Z"
}

Steps to Reproduce:

  1. Attempt to send an SMS verification code to the phone number +400730679600 using Firebase Authentication.
  2. Observe that the request fails with error code 39 intermittently.

What I've Tried:

  1. Confirmed that the phone numbers are valid and can receive SMS from other providers.
  2. Attempted multiple times on different days to rule out temporary issues.
  3. Reviewed Firebase documentation and error codes but found no specific details for error code 39.

Has anyone experienced similar issues with Firebase SMS verification? Any insights or suggestions would be greatly appreciated. Thank you!

note that +400730679600 is my own test number
<p>I'm experiencing an issue with Firebase where SMS verification codes are not sent to some valid phone numbers. These numbers are able to receive SMS from other providers without any issues. The problem has been observed over multiple attempts on different days. Here are the details:</p>
<pre><code>{
"insertId": "-k92yxdd8v6y",
"jsonPayload": {
"@type": "type.googleapis.com/google.cloud.identitytoolkit.logging.RequestLog",
"methodName": "google.cloud.identitytoolkit.v1.AuthenticationService.SendVerificationCode",
"status": {
"message": "Error code: 39",
"code": 13
},
"request": {
"@type": "type.googleapis.com/google.cloud.identitytoolkit.v1.SendVerificationCodeRequest",
"phoneNumber": "+400730679600"
},
"requestMetadata": {
"callerIp": "86.124.126.97",
"callerSuppliedUserAgent": "FirebaseAuth.iOS/10.22.0 ro.afooddeployments.afood/3.4.0 iPhone/17.4.1 hw/iPhone14_5,gzip(gfe),gzip(gfe)"
},
"serviceName": "identitytoolkit.googleapis.com"
},
"resource": {
"type": "identitytoolkit_project",
"labels": {
"project_id": "ambrosia-e5ea3"
}
},
"timestamp": "2024-06-17T08:49:19.981Z",
"severity": "ERROR",
"logName": "projects/ambrosia-e5ea3/logs/identitytoolkit.googleapis.com%2Frequests",
"receiveTimestamp": "2024-06-17T08:49:20.859697728Z"
}
</code></pre>
<p><strong>Steps to Reproduce:</strong></p>
<ol>
<li>Attempt to send an SMS verification code to the phone number
+400730679600 using Firebase Authentication.</li>
<li>Observe that the request fails with error code 39 intermittently.</li>
</ol>
<p><strong>What I've Tried:</strong></p>
<ol>
<li>Confirmed that the phone numbers are valid and can receive SMS from
other providers.</li>
<li>Attempted multiple times on different days to rule out temporary
issues.</li>
<li>Reviewed Firebase documentation and error codes but found no
specific details for error code 39.</li>
</ol>
<p>Has anyone experienced similar issues with Firebase SMS verification? Any insights or suggestions would be greatly appreciated. Thank you!</p>
<p><em>note that +400730679600 is my own test number</em></p>
Continue reading...
 
The issue you're encountering with Firebase SMS verification not being sent to some valid phone numbers and returning error code 39 could be due to several factors. Here are some steps and suggestions to help troubleshoot and resolve the issue:

### 1. Verify Firebase Quotas and Limits
Ensure that your Firebase project hasn't exceeded any quotas or limits for sending SMS. Check the [Firebase console](https://console.firebase.google.com/) under the usage section.

### 2. Check for Regional Restrictions
Some phone numbers, especially those in certain regions, may face restrictions or limitations on receiving SMS from Firebase. Confirm that the phone number you're testing with is supported by Firebase SMS services.

### 3. Error Code 39 Specifics
Although Firebase documentation might not provide specific details about error code 39, it usually indicates a general failure. Check the [Google Cloud Status Dashboard](https://status.cloud.google.com/) for any ongoing issues that might affect Firebase services.

### 4. Carrier Filtering
In some cases, mobile carriers may filter out messages that appear to be spam or from untrusted sources. Contact the carrier to ensure that messages from Firebase are not being blocked.

### 5. Verify Configuration
Ensure that your Firebase Authentication settings are correctly configured for SMS authentication. Double-check the SHA-1 and SHA-256 keys in the Firebase console.

### 6. Debugging and Logs
Review the logs in the Firebase console for any additional details about the error. Sometimes logs provide more context that can help identify the issue.

### 7. Contact Firebase Support
If the issue persists, consider reaching out to [Firebase support](https://firebase.google.com/support) with detailed logs and error information. They can provide more specific insights and assistance.

### Example Code to Send SMS Verification
Ensure that your code to send the SMS verification is correct. Here’s an example for reference:

```dart
import 'package:firebase_auth/firebase_auth.dart';

Future<void> sendSmsCode(String phoneNumber) async {
FirebaseAuth auth = FirebaseAuth.instance;
await auth.verifyPhoneNumber(
phoneNumber: phoneNumber,
timeout: const Duration(seconds: 60),
verificationCompleted: (PhoneAuthCredential credential) async {
// Auto-retrieve or instant verification on Android
},
verificationFailed: (FirebaseAuthException e) {
if (e.code == 'invalid-phone-number') {
print('The provided phone number is not valid.');
} else {
print('Verification failed with code: ${e.code}');
}
},
codeSent: (String verificationId, int? resendToken) {
print('Verification code sent to $phoneNumber.');
// Save the verificationId and resendToken for later use
},
codeAutoRetrievalTimeout: (String verificationId) {
print('Code auto-retrieval timeout.');
},
);
}
```

By following these steps, you should be able to identify and resolve the issue with SMS verification codes not being sent to some valid phone numbers. If the problem persists, detailed logs and Firebase support will be crucial in troubleshooting further.
 

Latest posts

M
Replies
0
Views
1
Marcos R. Guevara
M
Top