Skip to content

Cannot upload attachments #247

@sinus-x

Description

@sinus-x

What happened?

Whenever I try to upload an avatar or an emoji, it is rejected by the backend with error 500.

Browser logs
POST https://stoat.example.org/autumn/emojis

Content-Disposition: form-data; name="file"; filename="__.png"
Content-Type: image/png

<binary data>

receives response 500 {"type":"InternalError","location":"crates/core/files/src/lib.rs:28:5"}

PUT https://stoat.example.org/api/custom/emoji/undefined

{"parent":{"type":"Server","id":"01KJC6ZQ204YH2R36ZJHMJ1MZV"},"name":"__"}

receives response 404 {"type":"NotFound","location":"crates/core/database/src/models/files/ops/mongodb.rs:100:24"}

Container logs
stoat-api[70475]:  INFO  rocket::server    > POST /sync/settings/fetch? text/plain:
stoat-api[70475]:  INFO  rocket::server::_ > Matched: (fetch) POST /sync/settings/fetch
stoat-api[70475]:  INFO  rocket::server::_ > Outcome: Success(200 OK)
stoat-api[70475]:  INFO  rocket::server::_ > Response succeeded.
stoat-api[70475]:  INFO  rocket::server    > GET /sync/unreads?:
stoat-api[70475]:  INFO  rocket::server::_ > Matched: (unreads) GET /sync/unreads
stoat-api[70475]:  INFO  rocket::server::_ > Outcome: Success(200 OK)
stoat-api[70475]:  INFO  rocket::server::_ > Response succeeded.
stoat-for-web[70529]:   [12:23:21] 200 ─ 0.97ms ─ /serviceWorker.js
stoat-file-server[69910]:  INFO  revolt_autumn::api > Received file __.png
stoat-file-server[69910]: Original hash: 997b3376399f34ca6807bca58b7e88e8bb989da789f51eac8ae77a187e766405
stoat-file-server[69910]: Original size: 35588 bytes
stoat-file-server[69910]: Mime type: image/png
stoat-file-server[69910]: Metadata: Image { width: 128, height: 128 }
stoat-file-server[69910]: Processed file size: 22952 bytes (64.49%).
stoat-file-server[69910]: Processed hash: a5bfc9fb508fc357096ea49c73fd5761224cfdb35efd2b173bd8f5bd7a6dfdae
stoat-file-server[69910]: Processing took 1.570631ms
stoat-api[70475]:  INFO  rocket::server    > PUT /custom/emoji/undefined? text/plain:
stoat-api[70475]:  INFO  rocket::server::_ > Matched: (create_emoji) PUT /custom/emoji/<id>
stoat-api[70475]:  INFO  rocket::server::_ > Outcome: Success(404 Not Found)
stoat-api[70475]:  INFO  rocket::server::_ > Response succeeded.

The file does not get saved to MinIO, the bucket is empty.

Steps to reproduce:

  1. Deploy the services listed in compose.yml
  2. Create an account and log in
  3. Go to Server settings
  4. Go to Emojis tab
  5. Upload an emoji, give it a name and click Create

How reproducible:

Always

Version information:

$ podman image ls | grep -e mongo -e for-web -e file-server -e api -e minio
ghcr.io/stoatchat/for-web         addb6b7     6a4328ccd016  9 days ago    214 MB
docker.io/library/mongo           latest      f0286cc18189  10 days ago   945 MB
ghcr.io/stoatchat/file-server     v0.11.1     ae9275e5db2c  2 weeks ago   323 MB
ghcr.io/stoatchat/api             v0.11.1     cd64a528b3cd  2 weeks ago   71.2 MB
quay.io/minio/minio               latest      69b2ec208575  5 months ago  176 MB

Additional Information:

I have deployed the services via Podman Quadlets, I do not have Docker and its compose available. But I do believe everything is set up correctly; in MinIO Web UI, I can log in with the configured credentials, and it does have 'revolt-uploads' configured as the default bucket, which means Stoat did manage to connect to it before.

In case this is a configuration issue, what do I need to include in stoatchat/stoatchat repository bug report to make sure these configuration issues have better visibility in logs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions