Back

Create document in Flutter Windows

  • 0
  • Databases
  • Flutter
Mosh Ontong
9 Apr, 2023, 12:18

I got an error when I am trying to create documents. This is my full code

TypeScript
 Future<void> createVocabulary(Vocabulary vocabulary) async {
    final databases = Databases(ref.read(appwriteClientProvider));

    try {
      await databases.createDocument(
          databaseId: kDatabaseId,
          collectionId: kVocabularyCollectionId,
          documentId: ID.unique(),
          data: vocabulary.toDocument());
    } on AppwriteException catch (e) {
      _logger.severe(e.message);
      state = AsyncError(e.message ?? 'Failed to create ${vocabulary.word}',
          StackTrace.current);
    }
  }

And see the picture attach on how I initialize the appwrite client:

And this is the error I got:

TypeScript
 Invalid Origin. Register your new client (minna_transcriber) as a new Windows platform on your project console dashboard
TL;DR
The user was experiencing an error while trying to create documents in their Flutter Windows project. They received an error message stating 'Invalid Origin. Register your new client (minna_transcriber) as a new Windows platform on your project console dashboard'. They already fixed the issue by renaming the package name in Windows to 'minna_transcriber'.
Arth
9 Apr, 2023, 12:51

did you add flutter platform in your project in appwrite console? @Mosh Ontong

Mosh Ontong
9 Apr, 2023, 12:52

yes I already add

Mosh Ontong
9 Apr, 2023, 12:53

Actually everything is okay, I can fetch data from appwrite, but when I am creating documents in client side or in my flutter project. It got me faield

Mosh Ontong
9 Apr, 2023, 12:58

how can I fix this sir @Arth ?

Arth
9 Apr, 2023, 12:59

I'm not very familiar with flutter sorry, that was something that I thought could be raising that issue

Arth
9 Apr, 2023, 13:00

is there an active session when creating documents? I think user needs to be authenticated to write, but the error message doesn't look like if that's the issue

Mosh Ontong
9 Apr, 2023, 13:08

actually there is no active session, what I did that this particular collection's permission I set to any role and have all the privileges. I am now trying to create a login page. I will inform you later if the error still exist.

Mosh Ontong
9 Apr, 2023, 13:41

even in authentication

Mosh Ontong
9 Apr, 2023, 13:42

@Arth

Mosh Ontong
9 Apr, 2023, 14:08

anyways I already fixed it I just rename the package name in windows into minna_transcriber

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