Back

[SOLVED] AppwriteException: null, File bytes must be provided for Flutter web (0)

  • 0
  • Flutter
  • Storage
Binyamin
24 Aug, 2023, 23:11

Like

TypeScript
        filename: 'test_name.jpg',
TL;DR
Title: [SOLVED] Issue with AppwriteException: null, File bytes must be provided for Flutter web (0) Solution: The user forgot to provide the endpoint when creating the file object. They should use `createFile.fromBytes` instead of `createFile.fromPath`. Additionally, they need to initialize the client properly by setting the endpoint and project ID. They should also ensure that the client is pointing to the correct port for their local Flutter project. To further debug, they can print the stack trace by adding `catch(e, stacktrace)` and print both for additional debugging. The user should also check if the file
Passa o Link
24 Aug, 2023, 23:18

like this?

Binyamin
24 Aug, 2023, 23:18

Yes but the payload and preview tabs

Binyamin
24 Aug, 2023, 23:19

Is this a local environment?

Binyamin
24 Aug, 2023, 23:19

How you've initialized your client?

Mosh Ontong
24 Aug, 2023, 23:21

you can also print the the stack trace by adding a stackTrace beside of the e in the catch

In instance, catch(e,stacktrace) then try to print these both for additional debuging

Passa o Link
24 Aug, 2023, 23:24

i'm using the cloud i guess, is the one with the endpoint ''https://cloud.appwrite.io/v1"

Passa o Link
24 Aug, 2023, 23:25

they show this:

Binyamin
24 Aug, 2023, 23:25

I think you need to add the client initializing code

Binyamin
24 Aug, 2023, 23:26

Like so:

TypeScript
Client client = Client()
    .setEndpoint('https://cloud.appwrite.io/v1')
    .setProject('[PROJECT_ID]');         // Your project ID

Right now the request pointing to :51188 which is the port of your local flutter project in the browser

Binyamin
24 Aug, 2023, 23:26

Have you initialized the client like so?

Passa o Link
24 Aug, 2023, 23:27

yeah like this

TypeScript
client = Client().setEndpoint(endPoint).setProject(projectId);
Binyamin
24 Aug, 2023, 23:28

Maybe it happened after the storage? Can you print it to see that is correct?

Passa o Link
24 Aug, 2023, 23:30

I DID IT

Binyamin
24 Aug, 2023, 23:30

What?

Passa o Link
24 Aug, 2023, 23:30

i create the file on the bucket

Binyamin
24 Aug, 2023, 23:31

What you've changed?

Passa o Link
24 Aug, 2023, 23:31

i think i forgot the endpoint like you say

Binyamin
24 Aug, 2023, 23:31

At last it worked

Binyamin
24 Aug, 2023, 23:31

<a:agooglethumbsup:635256484682530825>

Passa o Link
24 Aug, 2023, 23:34

i will check again just to place the answer here

Passa o Link
24 Aug, 2023, 23:48

yeah, i forgot the endpoint and i have to do the createFile.fromBytes instead the .fromPath

Passa o Link
24 Aug, 2023, 23:49

thank you so much, sorry for taking your time for such a silly mistake

Passa o Link
24 Aug, 2023, 23:50

[SOLVED] AppwriteException: null, File bytes must be provided for Flutter web (0)

Binyamin
24 Aug, 2023, 23:54

Not a problem. Gladly

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