I’ll check this in some time and revert.
Apologies for the delayed response, but it was because I was trying multiple stuff. Seems like I’m running out of options and I seriously don’t know what I’m missing myself. Looks like I need to go back at basics.
I created a branch called
test in my repo and tried various combinations of the config like:
[context.test] publish = "/" command = "echo 'branch-deploy'"
I still get
Deploy directory 'public' does not exist which is the publish path of my main branch (set in Netlify UI). According to the docs, the config file takes preference and with a specific context like the one above, it should have the highest preference. Oddly enough, the command is working fine, it’s just the publish path that won’t work.
You can try the above by creating another folder and keeping your
index.html in that folder and setting that as publish path, that is, you can have a config and file structure like this and it works (with the redirect):
I still feel that either I’m missing something or it’s a big or something because the previous configuration should have worked.
[build] from top to
[context.production] and see. However, since this is a branch deploy, I am assuming it’s from a different branch with different set of files. If that’s true, you don’t need the
[build] section at all as it’s anyways configured in your Netlify UI.
its a seperate branch called learn, I don’t see a way in the build ui to be different from all deploys, + prefer all config to be in code
Still same error , trying with [quote=“hrishikesh, post:24, topic:32959”]
Would it be possible for you to share the repo so I can try it on my end and revert? The issue is really strange and even more strange as it worked in my tests now. So, probably your code needs something more specific for some reason.
sure mate, whats your github?
Hrishikesh-K - https://www.github.com/Hrishikesh-K/
I’ve got the invite. I’ll get to this in some time.
Oh, it was a simple mistake. You didn’t have any
netlify.toml in your
branch-deploy. I just added one and pushed to my GitHub and it worked in one go.
you used the same toml as master?
Yes same file in both the branches.
how long does it take to update?
https://learn.nikoskatsikanis.com/episodes still is a blank page after pushing the toml to learn branch
why cant we just do a redirect just here
It works as soon as it’s deployed.
Because that’s not what the DNS is meant to do.
Seems like you’ve messed with the DNS settings, the learn… URL is not resolving anymore.
there is no entry for learn in the dns settings
Which means it’s deleted. Without that entry, the URL won’t resolve.
Yes. Add the root domain there.
You had this before, right? The URL resolved before as far as I remember. Any specific reason to delete the entry?
It’s because you’ve this in your
netlify.toml (in the learn branch):
[[redirects]] from = "/*" to = "/index.html" status = 200
Netlify parses redirects top to bottom. Thus, after the first rule is matched, the rest are ignored. That’s what’s happening there. The rules are getting matched for
/* first as it’s before the
learn... rule. Remove that and it should work.