Deploy to Netlify where the first build will fail (by design)

So I have a project the requires the user to have some API credentials/info in an environmental variable for the build to work. This means when deployed via the ‘Deploy to Netlify’ button (via https://app.netlify.com/start/deploy?repository=***), the build will fail the first time. That’s not a problem, as I was expecting I’d be able to add the necessary environment in Netlify settings and then manually trigger the build, but this doesn’t seem possible? Once the build fails the first time, the created repository is empty and you can’t trigger the build/deploy again? Is there any way around this?

Edit: Just saw that Netlify lets you add environmental variables when you’re creating a new site from git, but this feature is missing when going the ‘Deploy to Netlify’ button route. Having that feature would’ve been a nice solution and it would complete the build the first time :confused:

Hey @intricatebug, welcome to the forum!

It sounds like you may have already done this, but just in case you haven’t: I think you’d have to skip the “Deploy to Netlify” button and instead do that process manually: fork the repo, create a Netlify site that’s linked to the fork, the first deploy will fail, but you can then add environment variables and deploy again. If you want to share the repo you’re trying to deploy, we can try to help walk you through?

I hear you that it would be nice to incorporate env vars with the button somehow, but I’m not sure how that would work… would you set the vars as query parameters in the browser’s URL bar? Or would the button take you to a screen that asks if you have any env variables? Something else? :face_with_monocle:

Hey @jen! Yes, this. The ‘New site from Git’ flow already has this:

So the same could be added to this screen, which is from the “Deploy to Netlify” flow:
(could be behind an Advanced settings button, like in the other flow)

Thanks for the suggestion! I’ve passed it on to our product team.