Open Wituareard opened 2 months ago
Maybe a try catch error handler? Not sure.
It's a two-part problem:
I'd suggest
.env.local
file and publishing a .env
file with empty values to Git as suggested in the Vite guide/people
from prerendering, which would also resolve #145I'll create a PR for 1. so you can rename your local file before removing the name from the .gitignore
Included the full solution in the PR
I think publishing a .env
is a bad practice, very easy to leak secrets this way.
We should circumvent the initial setup bug in some other way, and re-add the .env
to .gitignore
.
I was a bit skeptical as well but chose to propose it anyway because it's suggested in the Vite guide. The previous version excluded a .env.example
which could be a solution, but I don't know if that would overwrite the .env.local
.
I could add a template.env
and a line to the readme. The .env
will be added to the gitignore to prevent leaks
What do you think of this @Wituareard ? OK to close?
It tested it and .env.example
is overwritten by both .env
and .env.local
so I'd prefer that solution because it works plug-and-play. Additionally, I could add a big warning to .env.example
.
Okay nvm .env.example
isn't loaded at all. Maybe a big warning in .env
would be enough?
# _____ _ _ _ _ _
# | __ \ | | | | | | | | | |
# | | | | ___ _ __ | |_ ___ _ __ | |_ ___ _ __ ___ ___ ___ _ __ ___ | |_ ___ | |__ ___ _ __ ___ | |
# | | | | / _ \ | '_ \ | __| / _ \| '_ \ | __|/ _ \| '__| / __| / _ \ / __|| '__|/ _ \| __|/ __| | '_ \ / _ \| '__|/ _ \| |
# | |__| || (_) || | | || |_ | __/| | | || |_| __/| | \__ \| __/| (__ | | | __/| |_ \__ \ | | | || __/| | | __/|_|
# |_____/ \___/ |_| |_| \__| \___||_| |_| \__|\___||_| |___/ \___| \___||_| \___| \__||___/ |_| |_| \___||_| \___|(_)
#
# Secrets go in a .env.local file.
But I can also live with the current solution. I'd just prefer if it worked out-of-the-box.
If you want to keep the current solution, you can close the issue.
Hi, I'm working on bringing a version of the website online for France and I ran into this. The /teams
route is also currently prerendered, so even with /people
excluded the build fails if the API key is present but invalid (which is the case after following the setup instructions). Excluding /teams
from prerendering works for building but idk if that's something you want to do, given that if I understand correctly there's no attachments on that page. If I might suggest something, it's possible to build in "development" mode though, so you can disable prerendering only in that case.
On a related note, I also think the Airtable URLs should be in the environment, even if they're not secret. I personally also added checks to see if all these variables are set.
I'm happy to submit PRs for any of this.
Local builds fail because the environment variable containing the Airtable API key is missing. Not sure about the best way to fix this.