I have a working site using a .env file. I added some new environment variables to the .env file and deployed, which resulted in a runtime error with flutter_sentry as it expected those environment variables to be present but they weren't.
However, in a new browser I had no runtime error.
After investigating I compared the contents of the deployed .env file with my local .env file and found out they did not match. This was because my browser (correctly) cached the .env file. I had to set up a new .env.1 file for a panicked quick production deploy to fix this (let's pretend for a second that this was not to a high traffic ecommerce site of a major international brand).
It should be included in the documentation in large, capital letters that the server MUST be configured to set a cache-control: none header on .env files otherwise new environment variables will not be loaded by Flutter.
Alternatively, this package should either:
add a random number onto the env file .env.1 when building, or:
add a random querystring value when making the HTTP request to the .env file.
I have a working site using a
.env
file. I added some new environment variables to the.env
file and deployed, which resulted in a runtime error withflutter_sentry
as it expected those environment variables to be present but they weren't.However, in a new browser I had no runtime error.
After investigating I compared the contents of the deployed
.env
file with my local.env
file and found out they did not match. This was because my browser (correctly) cached the.env
file. I had to set up a new.env.1
file for a panicked quick production deploy to fix this (let's pretend for a second that this was not to a high traffic ecommerce site of a major international brand).It should be included in the documentation in large, capital letters that the server MUST be configured to set a
cache-control: none
header on.env
files otherwise new environment variables will not be loaded by Flutter.Alternatively, this package should either:
.env.1
when building, or:.env
file.