Error Loading Image from S3 bucket on Local Minio Server

I am trying to do image labeling on my laptop and am using Minio as a local file store. I think I’ve got everything set up correctly, but I get an error when I try to load an image URL in my project.

I use the following docker-compose.yml to create Label Studio and Minio containers.

services:
  label_studio:
    image: heartexlabs/label-studio:latest
    env_file:
      - .env
    ports:
      - "8080:8080"
    entrypoint: >
      /bin/sh -c "
      label-studio start --username $LABEL_STUDIO_USERNAME --password $LABEL_STUDIO_PASSWORD --user-token $LABEL_STUDIO_TOKEN || true &&
      label-studio"
    volumes:
      - label_studio_data:/label-studio/data

  minio:
    image: minio/minio:latest
    ports:
      - "9000:9000"
      - "9001:9001"
    env_file:
      - .env
    entrypoint: >
      /bin/sh -c "
      minio server /data --console-address :9001"
    volumes:
      - minio_data:/data
      - minio_config:/root/.minio

volumes:
  label_studio_data:
  minio_data:

I can interact with the Label Studio and Minio web UIs.

On my Minio server I have a “label-studio/page-images” directory containing a bunch of .png files. I have created a project that uses the “Semantic Segmentation with Polygons” template and I set up Minio as an S3 cloud storage source. The configuration panel looks like this.

I have the access key and secret access key set to the Minio username/password minioadmin/minioadmin. I have successfully synced this storage source and see one task for every image in the folder. Paths to these images are created in the “image” column of my project. Here is an example:

{
  "id": 1,
  "data": {
    "image": "/tasks/1/presign/?fileuri=czM6Ly9sYWJlbC1zdHVkaW8vcGFnZS1pbWFnZXMvTklQUy0yMDE3LWF0dGVudGlvbi1pcy1hbGwteW91LW5lZWQtUGFwZXIucGRmLjEucG5n"
  },
  "annotations": [],
  "predictions": []
}

However, Label Studio cannot load the images. I see the salmon colored error box with the following text.

There was an issue loading URL from $image value

Things to look out for:

  • URL is valid
  • URL scheme matches the service scheme, i.e. https and https
  • The static server has wide-open CORS, more on that here

Whenever I’ve encountered this error in the past, it’s been due to some misconfigured URL (and never a CORS problem). I’ve been all over my configuration and can’t see anything wrong.

Can you see something I’m doing wrong or suggest further debugging steps.

Thanks.

Actually never mind. The trick was to change the cloud source configuration to not use presigned URLs.

It looks like the entire contents of the image get added to my project. Is there some way to prevent that when I’m using Minio?

Pre-signed urls must be turned on, otherwise you will face with performance issues if you try to load big image and if you try to process LS tasks further after the export.

Most likely, your minio configuration with CORS is wrong. Check your browser network console to see what errors you have there.

With pre-signed images turned on the console has lots of “Failed to fetch” errors. The Network tab of the Chrome developer tools shows failed requests of the form http://localhost:8080/tasks/76/presign/?fileuri=.... I don’t know what failed: there’s no response information. These requests have the “same-origin” referrer policy.

After those I see what look like identical requests, except they get HTTP 303 responses. The responses have Referrer policy “same-origin”.

Then I see a bunch of requests for what look like non pre-signed URLs. There are of the form http://minio:9000/label-studio/page-images/my-file-name.... These have a Referrer policy of “same origin” and again fail for unknown reasons.

I am running Label Studio inside containers, and the Minio container is named “minio”. So that’s why you sometimes see “localhost” and other times see “minio”. I bet my hitting refresh provoked the first batch of “localhost” requests and afterwards Label Studio initiated its own “minio” requests, but I can’t tell.

Does this look like an incorrect CORs setup? I can’t tell.