Skip to content

Rocket.Chat Docker Setup – File upload fails for images with “A boolean was expected [ufs: cannot upload file] [upload-failed] #36065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Frontendxperts opened this issue May 22, 2025 · 8 comments

Comments

@Frontendxperts
Copy link

I'm running a Rocket.Chat 7.5.0 instance using Docker and Docker Compose. The app is built from a Meteor bundle and uses a custom Dockerfile. Everything starts up correctly, and I'm able to use the app. However, I'm facing an issue when trying to upload image files in the chat window.

Uploading .json and .html files works fine, but image uploads fail with the following error:

    {
      "success": false,
      "error": "TypeError: A boolean was expected [ufs: cannot upload file] [upload-failed]",
      "errorType": "upload-failed"
    }

Dockerfile (relevant part):

FROM node:22.13.1-bullseye-slim

# ... (installs, setup, and copying bundle)

# Set environment variables
ENV PORT=3000 \
    NODE_ENV=production \
    ROOT_URL=http://localhost:3000 \
    MONGO_URL=mongodb://mongo:27017/rocketchat?replicaSet=rs0 \
    MONGO_OPLOG_URL=mongodb://mongo:27017/local?replicaSet=rs0 \
    WAIT_FOR_MONGO=true

EXPOSE 3000
ENTRYPOINT ["/app/entrypoint.sh"]

docker-compose.yml (relevant part)

services:
  rocketchat:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    volumes:
      - ./uploads:/app/uploads
    environment:
      - MONGO_URL=mongodb://mongo:27017/rocketchat?replicaSet=rs0
      - MONGO_OPLOG_URL=mongodb://mongo:27017/local?replicaSet=rs0
      - ROOT_URL=http://localhost:3000
      - PORT=3000
      - NODE_ENV=production
      - WAIT_FOR_MONGO=true
      - SITE_URL=http://localhost:3000

Additional Details:

  • Rocket.Chat runs fine otherwise.
  • The uploads folder is mounted properly.
  • Issue occurs only with images (.png, .jpg, etc.).
  • Error suggests a type mismatch: “A boolean was expected”.

What I've Tried:

  • Verified folder permissions on the uploads directory. (chmod 777, 775 on app/uploads folder inside docker container)
  • Checked Rocket.Chat logs for any other clues.
  • Compared working uploads (.json, .html) vs non-working image types.

Question:

  • How can I resolve this image upload error?
  • Is there a missing configuration in my Dockerfile, environment variables, or Rocket.Chat file store settings?

Any guidance or insight would be appreciated.

FYI: when I run meteor run in IDE the uploads works all images and other files get uploaded as well.

@reetp
Copy link

reetp commented May 25, 2025

Please note you are not using a "supported" option per the docs. YMMV.

Next follow the bug reporting guidelines and test on latest. At least 7.5.1 or 7.6.1

I'd suggest start testing with the recommended compose setup.

Next, a lot of issues are caused by badly configured reverse proxies (you are using one as per the docs? You should not be running http://server:3000)

Go back and check https and check your websockets work.

I think there was a very unusual bug fixed here but not sure it affects you.

#35839

And then there is this which has also been reported here if you search thoroughly:

https://forums.rocket.chat/t/images-missing-after-upgrading-to-7-3-4/22106

Check correct user & perms on uploads dir.

@raheelahmad786
Copy link

raheelahmad786 commented May 25, 2025

Hi @reetp

I’m experiencing the same problem. All other files upload fine, but whenever I try to send or upload an image through the web interface, I get this error. I’m using version 7.5.0.

{"level":20,"time":"2025-05-24T21:24:21.222Z","pid":1,"hostname":"29546936980c","name":"Rooms","msg":"rooms.media fileStore: 'GridFS:Uploads'"}
{"level":50,"time":"2025-05-24T21:24:21.241Z","pid":1,"hostname":"29546936980c","name":"Rooms","msg":"rooms.media upload failed: {"isClientSafe":true,"error":"ufs: cannot upload file","reason":{},"message":"TypeError: A boolean was expected [ufs: cannot upload file]","errorType":"Meteor.Error"}"}
{"level":35,"time":"2025-05-24T21:24:21.242Z","pid":1,"hostname":"29546936980c","name":"API","method":"POST","url":"/v1/rooms.media/9YyzzqbFtfAxcLtPxrocket.cat","userId":"9YyzzqbFtfAxcLtPx","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36","length":"38722","host":"dev.cybersmartu.club","referer":"https://dev.cybersmartu.club/direct/9YyzzqbFtfAxcLtPxrocket.cat","remoteIP":"172.18.0.6","status":400,"responseTime":33}

These are the mongo configurations in the database.

{
_id: 'FileUpload_Enable_json_web_token_for_files',
value: false
}
{
_id: 'FileUpload_Enabled',
value: true
}
{
_id: 'FileUpload_Enabled_Direct',
value: true
}
{
_id: 'FileUpload_FileSystemPath',
value: ''
}
{
_id: 'FileUpload_GoogleStorage_AccessId',
value: ''
}
{
_id: 'FileUpload_GoogleStorage_Bucket',
value: ''
}
{
_id: 'FileUpload_GoogleStorage_ProjectId',
value: ''
}
{
_id: 'FileUpload_GoogleStorage_Proxy_Avatars',
value: false
}
{
_id: 'FileUpload_GoogleStorage_Proxy_Uploads',
value: false
}
{
_id: 'FileUpload_GoogleStorage_Proxy_UserDataFiles',
value: false
}
{
_id: 'FileUpload_GoogleStorage_Secret',
value: ''
}
{
_id: 'FileUpload_MaxFileSize',
value: 104857600
}
{
_id: 'FileUpload_MediaTypeBlackList',
value: 'image/svg+xml'
}
{
_id: 'FileUpload_MediaTypeWhiteList',
value: ''
}
{
_id: 'FileUpload_ProtectFiles',
value: false
}
{
_id: 'FileUpload_Restrict_to_room_members',
value: false
}
{
_id: 'FileUpload_Restrict_to_users_who_can_access_room',
value: false
}
{
_id: 'FileUpload_RotateImages',
value: false
}
{
_id: 'FileUpload_S3_AWSAccessKeyId',
value: ''
}
{
_id: 'FileUpload_S3_AWSSecretAccessKey',
value: ''
}
{
_id: 'FileUpload_S3_Acl',
value: ''
}
{
_id: 'FileUpload_S3_Bucket',
value: ''
}
{
_id: 'FileUpload_S3_BucketURL',
value: ''
}
{
_id: 'FileUpload_S3_CDN',
value: ''
}
{
_id: 'FileUpload_S3_ForcePathStyle',
value: false
}
{
_id: 'FileUpload_S3_Proxy_Avatars',
value: false
}
{
_id: 'FileUpload_S3_Proxy_Uploads',
value: false
}
{
_id: 'FileUpload_S3_Proxy_UserDataFiles',
value: false
}
{
_id: 'FileUpload_S3_Region',
value: ''
}
{
_id: 'FileUpload_S3_SignatureVersion',
value: 'v4'
}
{
_id: 'FileUpload_S3_URLExpiryTimeSpan',
value: 120
}
{
_id: 'FileUpload_Storage_Type',
value: 'GridFS'
}
{
_id: 'FileUpload_Webdav_Password',
value: ''
}
{
_id: 'FileUpload_Webdav_Proxy_Avatars',
value: false
}
{
_id: 'FileUpload_Webdav_Proxy_Uploads',
value: false
}
{
_id: 'FileUpload_Webdav_Proxy_UserDataFiles',
value: false
}
{
_id: 'FileUpload_Webdav_Server_URL',
value: ''
}
{
_id: 'FileUpload_Webdav_Upload_Folder_Path',
value: ''
}
{
_id: 'FileUpload_Webdav_Username',
value: ''
}
{
_id: 'FileUpload_json_web_token_secret_for_files',
value: ''
}

@reetp
Copy link

reetp commented May 25, 2025

Don't '@' me. I don't work here.

I’m using version 7.5.0.

Follow my comments regarding versions, reverse proxy etc.

_id: 'FileUpload_Storage_Type',
value: 'GridFS'

Note you should not be using GridFS.

This is documented. Please go back and read.

@Frontendxperts
Copy link
Author

@reetp Hey man, i switched to GCP storage now. Still it doesnt work if i run via docker-compose and UI/mongo has correct config details and when i upload it throws NoSuchKey exception in ufscomplete method. On localhost:3000 when i run rocketchat via meteor run the same GCP storage config works file gets uploaded in bucket. Can you please guide?

@reetp
Copy link

reetp commented May 31, 2025

You don't need to '@' anyone. I don't work here. You'll just get ignored.

Note github is for bugs, not setup/support.

Use

https://forums.rocket.chat/

Or

https://open.rocket.chat/channel/support

@Frontendxperts
Copy link
Author

I have tried on other forums, no one replied. Only you have so please if you can guide I'd be grateful.

@reetp
Copy link

reetp commented May 31, 2025

open source != free support

Stack overflow is not something that is monitored by anyone here. YMMV.

Generally in foros or open people will help if they can.

If they can't or don't it doesn't make this a bug.

On localhost:3000 when i run rocketchat via meteor run the same GCP storage config works file gets uploaded in bucket

I which case this isn't a bug but a setup issue so closing this for now - if you do find a bug it can be re-opened.

Go back and do a default docker-compose install as per the docs and work from there.

Thanks.

@reetp reetp closed this as completed May 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants