Why doesn't it work for open-saas? Because in open-saas, wasp app is one level deeper from the root of the repo (top level is app/ and blog/). Why is this an issue? Because Netlify resolves that build.publish path against what they call "base dir", and if not specified, they determine "base dir" as a root of the git repo. Which means that when generating netlify.toml, we assumed how far will the .wasp/build/web-app/build/ be positioned from the root of the git repo, while that is an assumption we really shouldn't be making, as it can be anything really.
Determine git repo root ourselves and make build.publish be correctly relative to it. Be careful, git repo root might not be the same thing as wasp project root.
Make build.publish be just build/ but then also set "base dir" in netlify.toml to the absolute location of .wasp/build/web-app -> we should be able to do that since we know absolute location of the wasp project. Or we could set "base dir" to wasp project root, and then leave build.publish as it is now. Whatever makes more sense semantically ("base dir" being wasp project vs generated web app).
(2) sounds like a winner to me at the moment.
There is one other interesting think to check though while at this: their docs say:
All paths configured in the netlify.toml should be absolute paths relative to the base directory, which is the root by default (/).
Sounds like all these paths should be absolute? But then they should also be relative to base dir? What does that mean, they are absoulte but not in relation to disk, but in relation to base dir? So it should be /.wasp/build/web-app/build/, instead of .wasp/build/web-app/build/? Check their examples of netlify.toml, I think that should clear this up, maybe they just phrased it weirdly.
This is what our netlify file contains:
The problem is, this doesn't work for open-saas. Check this discord convo: https://discord.com/channels/686873244791210014/1296434747500920842/1296609588417663086 .
Why doesn't it work for open-saas? Because in open-saas, wasp app is one level deeper from the root of the repo (top level is app/ and blog/). Why is this an issue? Because Netlify resolves that build.publish path against what they call "base dir", and if not specified, they determine "base dir" as a root of the git repo. Which means that when generating netlify.toml, we assumed how far will the .wasp/build/web-app/build/ be positioned from the root of the git repo, while that is an assumption we really shouldn't be making, as it can be anything really.
Reference: https://docs.netlify.com/configure-builds/monorepos/#set-the-base-directory
How can we fix this? I have a couple of ideas:
build.publish
be correctly relative to it. Be careful, git repo root might not be the same thing as wasp project root.build/
but then also set "base dir" in netlify.toml to the absolute location of.wasp/build/web-app
-> we should be able to do that since we know absolute location of the wasp project. Or we could set "base dir" to wasp project root, and then leave build.publish as it is now. Whatever makes more sense semantically ("base dir" being wasp project vs generated web app).(2) sounds like a winner to me at the moment.
There is one other interesting think to check though while at this: their docs say:
#
Sounds like all these paths should be absolute? But then they should also be relative to base dir? What does that mean, they are absoulte but not in relation to disk, but in relation to base dir? So it should be
/.wasp/build/web-app/build/
, instead of.wasp/build/web-app/build/
? Check their examples of netlify.toml, I think that should clear this up, maybe they just phrased it weirdly.