Issue with Filamentphp/ Minio unable to save file to bucket with FileUpload component

I have an issue with FileUpload Component with this issue :

Unable to retrieve the mime_type for file at location: livewire-tmp/3gV8mEXfLVdtzdvzKRuiGxHRe2Kjoj-metaSWNvbmUtQkxDLnBuZw%3D%3D-.png.

[previous exception] [object] (GuzzleHttpExceptionConnectException(code: 0): cURL error 7: Failed to connect to minio.cdm.local port 80 after 0 ms: Couldn’t connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://minio.cdm.local/public/livewire-tmp/3gV8mEXfLVdtzdvzKRuiGxHRe2Kjoj-metaSWNvbmUtQkxDLnBuZw%3D%3D-.png at /app/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:275)

That’s make me crazy because I’ve already test all configs.

this is my docker-compose with Traefik :

  traefik:
    image: "traefik:v3.0"
    container_name: "traefik"
    command:
      # - "--log.level=DEBUG"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entryPoints.web.address=:80"
    ports:
      - "80:80"
      - "8080:8080"
    networks:
      - internal-network
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

 cdm-app:
    depends_on:
      - traefik
      - mysql
      - minio
    build:
      context: ../../
      dockerfile: docker/local/images/cdm-app/Dockerfile
    volumes:
      - ../../src/cdm-app:/app
      - ./conf/php-fpm/docker.conf:/usr/local/etc/php-fpm.d/docker.conf
      -  ./conf/php-fpm/docker-fpm.ini:/usr/local/etc/php/conf.d/docker-fpm.ini
    networks:
      - internal-network

  nginx-cdm-app:
    image: nginx:latest
    volumes:
      - ./conf/nginx/nginx.conf:/etc/nginx/nginx.conf
      - ../../src/cdm-app:/app
    depends_on:
      - cdm-app
      - mysql
      - traefik
    networks:
      - internal-network
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.nginx-cdm-app.rule=Host(`cdm.local`)"
      - "traefik.http.routers.nginx-cdm-app.entrypoints=web" cdm-app:
    depends_on:
      - traefik
      - mysql
      - minio
    build:
      context: ../../
      dockerfile: docker/local/images/cdm-app/Dockerfile
    volumes:
      - ../../src/cdm-app:/app
      - ./conf/php-fpm/docker.conf:/usr/local/etc/php-fpm.d/docker.conf
      -  ./conf/php-fpm/docker-fpm.ini:/usr/local/etc/php/conf.d/docker-fpm.ini
    networks:
      - internal-network

  minio:
    image: 'minio/minio:RELEASE.2024-08-03T04-33-23Z'
    depends_on:
      - traefik
    ports:
      - '9000:9000'
      - '9001:9001'
    restart: always
    environment:
        MINIO_ROOT_USER: minio
        MINIO_ROOT_PASSWORD: "password"
        MINIO_HTTP_TRACE: /dev/stdout
    healthcheck:
      test: ["CMD", "mc", "ready", "local"]
      interval: 3s
      timeout: 10s
      retries: 10
    volumes:
      - '../../data/minio:/data/minio'
    command: 'minio server /data/minio --console-address ":9001"'
    networks:
      - internal-network
    labels:
      - "traefik.enable=true"
     # Console
      - "traefik.http.routers.minio-console.rule=Host(`console.cdm.local`)"
      - "traefik.http.routers.minio-console.entrypoints=web"
      - "traefik.http.routers.minio-console.service=minio-console"
      - "traefik.http.services.minio-console.loadbalancer.server.port=9001"
      # APi
      - "traefik.http.routers.minio.rule=Host(`minio.cdm.local`)"
      - "traefik.http.routers.minio.entrypoints=web"
      - "traefik.http.routers.minio.service=minio"
      - "traefik.http.services.minio.loadbalancer.server.port=9000"

I have already set my /etc/hosts to have DNS to localhost

here my config .env for Laravel :

APP_URL=http://cdm.local

AWS_ACCESS_KEY_ID=xxxxxx
AWS_SECRET_ACCESS_KEY=xxxxxxxxxxx
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=public
AWS_USE_PATH_STYLE_ENDPOINT=true
AWS_ENDPOINT=http://minio.cdm.local
AWS_URL=http://minio.cdm.local/public
MINIO_ENDPOINT=http://minio.cdm.local

I tried this test code :

Route::get('/test', function () {
    $fileName = 'test_file.png';


$filePath = sys_get_temp_dir() . '/' . $fileName;
file_put_contents($filePath, 'Test file content');

if (file_exists($filePath)) {
    echo "Fichier temporaire créé avec succès.n";
} else {
    echo "Erreur lors de la création du fichier temporaire.n";
    return;
}

try {
    $result = Storage::disk('s3')->put('test/' . $fileName, file_get_contents($filePath));
    echo $result ? "Fichier téléchargé avec succès.n" : "Échec du téléchargement du fichier.n";
  
    $mimeType = Storage::disk('s3')->mimeType('test/' . $fileName);
    echo "Type MIME du fichier téléchargé: " . $mimeType . "n";

    // Récupérez l'URL du fichier
    $url = Storage::disk('s3')->url('test/' . $fileName);
    echo "URL du fichier téléchargé: " . $url . "n";
} catch (Exception $e) {
    echo "Erreur lors du téléchargement ou de la récupération des informations du fichier: " . $e->getMessage() . "n";
}

});


and get this error :

Fichier temporaire créé avec succès.

Erreur lors du téléchargement ou de la récupération des informations du fichier: Unable to write file at location: test_file.png. Error executing “PutObject” on “http://minio.cdm.local/public/test_file.png”; AWS HTTP error: cURL error 7: Failed to connect to minio.cdm.local port 80 after 0 ms: Couldn’t connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://minio.cdm.local/public/test_file.png

That’s weird because the file wasn’t put in bucket.

Where am I missing something ?

New contributor

Ju Box is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật