-
flutter web firebasestorage cors error, The following ProgressEvent$ object was thrown resolving an image codec: [object ProgressEvent]Flutter ์ค๋ฅ 2023. 9. 25. 03:56
[๋ฌธ์ ์ํฉ]
Flutter web์์ Firebase storage์ ์ฌ๋ ค๋ ์ด๋ฏธ์ง๋ฅผ ์ฌ์ฉํ ๊ฒฝ์ฐ ์ค๋ฅ๊ฐ ๋จ๋ ์ํฉ
[ํด๊ฒฐ๋ฐฉ๋ฒ]
1. ํด๋น Firebase์ GCP(GoogleCloudPlatform)๋ก ์ด๋ํ๋ค
2.์ฐ์ธก ์๋จ์ ์๋ Cloud Shell ๋ฒํผ์ ๋๋ฅธ๋ค

3. ํฐ๋ฏธ๋์ด ํ์ฑํ๋๋ฉด echo '[{"origin": ["*"],"responseHeader": ["Content-Type"],"method": ["GET", "HEAD"],"maxAgeSeconds": 3600}]' > cors-config.json ๋ฅผ ์ ๋ ฅํ๋ค, ๋๋ ํน์ url์๋ง ํ์ฉํ๊ณ ์ถ๋ค๋ฉด echo '[{"origin": ["https://yourdomain.com"],"responseHeader": ["Content-Type"],"method": ["GET", "HEAD"],"maxAgeSeconds": 3600}]' > cors-config.json ๋ฅผ ์ ๋ ฅํ๋ค
4. Firebase storage์ ๊ฐ๋ฉด ๋ณผ ์ ์๋ BUCKET_NAME์ ๋ณต์ฌํ ํ gsutil cors set cors-config.json gs://YOUR_BUCKET_NAME๋ฅผ ์ ๋ ฅํ๋ค
BUCKET_NAME ์ ์ฌ์ง์ ๋ณด์ด๋ ๋งํฌ์์ด์ฝ ์์์๋ gs://๋ก ์์ํ๋ ๊ฒ์ ์๋ฏธํ๋ค

'Flutter ์ค๋ฅ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ