Back

Invalid Argument. No host specified in URI file

  • 0
  • Flutter
AshNair.eth
22 Aug, 2023, 07:38

I'm trying to create a user name and password in my Social Network app, and this keeps popping up.

class AppwriteConstants { static const String databaseID = '64df6c6d91........'; static const String projectID = '64df63.........'; static const String endPoint = 'http://My_Ip_Address/v1'; //static const String endPoint = 'http://localhost:80/v1'; }

I've tried both endPoint versions and i keep getting the same issue. Hope someone can help me!

TL;DR
The user is experiencing an "Invalid Argument" error related to the host not being specified in the URI file. They are unable to delete their Appwrite and are also facing issues with the Appwrite dashboard. They have confirmed that using the IP address and localhost 80 opens the dashboard on their browser. The user provides code snippets for the Appwrite client and account initialization, but the client code is not formatted properly. They are using port 80 and have tried both the IP address and localhost, but the issue persists. Solution: The user should ensure that the host is properly specified in the `AppwriteConstants` file. They
Maniac_Fighter
22 Aug, 2023, 10:02

can you show how do you intialise the client?

darShan
22 Aug, 2023, 10:03

using port 80 or anything else?

AshNair.eth
22 Aug, 2023, 10:21

import 'package:appwrite/appwrite.dart'; import 'package:appwrite/models.dart' as models; import 'package:communify_app/core/core.dart'; import 'package:communify_app/core/providers.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:fpdart/fpdart.dart';

final authAPIProvider = Provider((ref) { final account = ref.watch(appwriteAccountProvider); return AuthAPI(account: account); });

abstract class IAuthAPI { FutureEither<models.User> signUp({ required String email, required String password, }); }

class AuthAPI implements IAuthAPI { final Account _account;

AuthAPI({required Account account}) : _account = account;

@override FutureEither<models.User> signUp({ required String email, required String password, }) async { try { final models.User createdUser = await _account.create( userId: ID.unique(), email: email, password: password); return right(createdUser); } on AppwriteException catch (e, stackTrace) { return left( Failure(e.message ?? 'An unexpected error occurred', stackTrace), ); } catch (e, stackTrace) { return left( Failure(e.toString(), stackTrace), ); } } }

AshNair.eth
22 Aug, 2023, 10:22

i used createdUser because the Appwrite updated their files and removed Account from models.dart

Maniac_Fighter
22 Aug, 2023, 10:23

This is fine, I want to see the client code, how did you initalized the client object? And how are you passing it to the Account class

Maniac_Fighter
22 Aug, 2023, 10:23

FYI, use three back ticks to format your code

AshNair.eth
22 Aug, 2023, 10:27

sorry about this.

AshNair.eth
22 Aug, 2023, 10:43

i've got an appwrite_client.dart file

AshNair.eth
22 Aug, 2023, 10:43

import 'package:appwrite/appwrite.dart'; import 'package:communify_app/constants/appwrite_constants.dart';

class AppwriteClient { static late Client _client; static late Account account;

static void initialize() { _client = Client(); _client .setEndpoint(AppwriteConstants.endPoint) .setProject(AppwriteConstants.projectID);

TypeScript
account =
    Account(_client); // Initializing the account instance with the client.

}

static Client get client => _client; }

darShan
22 Aug, 2023, 10:48

just confirming again, did you install appwrite on port 80? on localhost? or there was another port used?

darShan
22 Aug, 2023, 10:49

on my local env, I usually use some other port like: static const String endPoint = 'http://localIpAddress:8990/v1';

AshNair.eth
22 Aug, 2023, 10:50

i installed it on 80

AshNair.eth
22 Aug, 2023, 10:50

localhost 80, yes correct

darShan
22 Aug, 2023, 10:51

does using http://localhost open appwrite's dashboard on your browser? Chrome, Safari?

AshNair.eth
22 Aug, 2023, 10:51

Yes it does.

AshNair.eth
22 Aug, 2023, 10:52

opens up Brave (chrome)

AshNair.eth
22 Aug, 2023, 10:53

even when i use my IP address, it opens up as well.

darShan
22 Aug, 2023, 11:09

using the ip works on phone's browser to open the dashboard?

AshNair.eth
22 Aug, 2023, 11:18

Yes it does.

AshNair.eth
22 Aug, 2023, 12:21

Im trying to delete my Appwrite to start over.

But that also is giving me issues. Lol.

&#97;&#x73;&#104;&#x40;&#x6c;&#105;&#103;&#104;&#x74;&#111;&#110;&#101;&#x2e;&#x69;&#111; role(users) missing scope (users.write)

Maniac_Fighter
22 Aug, 2023, 12:45

I think there is some issue with this code. I think your endpoint is not being set thus to this error. To confirm this , just add a breakpoint on whatever function you are executing (here signUp ig). And check for the value of host

Drake
23 Aug, 2023, 23:36

Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more