Hi there,
I host a flutter web app on firebase hosting. But I am getting the error: AppwriteExeption: null , XMLHttpRequest error (0)
Does anybody have an idea why i get this and even better how I can solve it.
Would help me out like a lot 🙂
Summary
The user was experiencing an AppwriteException with the error message "XMLHttpRequest error (0)". They later realized that they had not set the endpoint correctly. The user also asked for guidance on how to add the endpoint in the .env file. It was suggested to check for any errors in the network tabs and ensure that firebase-hosting endpoint was added as a platform in the project platforms. The user also provided a code snippet that handled the exception and asked for any error message generated. The user shared that they did not get the error on their local machine and asked for further assistance in resolving the issue.
Binyamin
Rank 7: Quantum Computer
Mar 30, 2023, 13:06
In what context you getting the error?
You don't get it in your local machine?
Binyamin
Rank 7: Quantum Computer
Mar 30, 2023, 13:07
Can you share the code + the error
Lenolium
Rank 2: Process
Mar 30, 2023, 13:07
I don't get in in my local machine
Lenolium
Rank 2: Process
Mar 30, 2023, 13:07
try {
final account = await _account.get();
return account.$id;
} on AppwriteException catch (error) {
if (error.code == 401) {
return null;
}
if (error.code == null || error.code == 0) {
rethrow;
}
rethrow;
}
Binyamin
Rank 7: Quantum Computer
Mar 30, 2023, 13:08
Add log here
Dart
try {
final account = await _account.get();
return account.$id;
} on AppwriteException catch (error) {
print(error.message);
if (error.code == 401) {
return null;
}
if (error.code == null || error.code == 0) {
rethrow;
}
rethrow;
}
And tell us what it says
Lenolium
Rank 2: Process
Mar 30, 2023, 13:08
AppwriteExeption: null , XMLHttpRequest error (0)
Binyamin
Rank 7: Quantum Computer
Mar 30, 2023, 13:09
The error code is also null?
Lenolium
Rank 2: Process
Mar 30, 2023, 13:09
yes
Binyamin
Rank 7: Quantum Computer
Mar 30, 2023, 13:10
And is the firebase-hosting endpoint was added as a platform in the project platforms?