flutter_dotenv icon indicating copy to clipboard operation
flutter_dotenv copied to clipboard

Error while trying to load an asset: Flutter Web engine failed to fetch "assets/.env". HTTP request succeeded, but the server responded with HTTP status 404.

Open YawarOsman opened this issue 2 years ago • 3 comments

When i try to load my .env file it shows this error:

Error while trying to load an asset: Flutter Web engine failed to fetch "assets/.env". HTTP request succeeded, but the server responded with HTTP status 404.

I have added this too:

  assets:
    - .env

YawarOsman avatar Jan 11 '24 13:01 YawarOsman

When i try to load my .env file it shows this error:

Error while trying to load an asset: Flutter Web engine failed to fetch "assets/.env". HTTP request succeeded, but the server responded with HTTP status 404.

I have added this too:

  assets:
    - .env

Same issue

nghiashiyi avatar Jan 15 '24 08:01 nghiashiyi

Same for me.

Error while trying to load an asset: Flutter Web engine failed to fetch "assets/assets/dotenv". HTTP request succeeded, but the server responded with HTTP status 404.

But my flutter web service worker has "assets/assets/dotenv": "4ef2f78446edff171436088341b541e3" in it's resources...?

MilanHofmann avatar Jan 27 '24 17:01 MilanHofmann

Same here,

I found that changing the file name to 'env' works on firebase web projects

https://{host}/assets/.env -> http 404 https://{host}/assets/env -> http 200

not sure if it is a firebase hosting problem

overall, I need to change env filename: .env to env pubspec.yaml

  assets:
    - env

and code:

await dotevn.load(fileName: 'env')

wj-yang-pro avatar Jun 24 '24 03:06 wj-yang-pro