Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix netlify.toml that we generate for a web app (client) #2352

Open
Martinsos opened this issue Oct 21, 2024 · 0 comments
Open

Fix netlify.toml that we generate for a web app (client) #2352

Martinsos opened this issue Oct 21, 2024 · 0 comments
Labels
bug Something isn't working deployment

Comments

@Martinsos
Copy link
Member

This is what our netlify file contains:

[build]
  publish = ".wasp/build/web-app/build/"

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200
  force = false

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

image

How can we fix this? I have a couple of ideas:

  1. 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.
  2. 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.

@Martinsos Martinsos added bug Something isn't working deployment labels Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working deployment
Projects
None yet
Development

No branches or pull requests

1 participant