I have a monorepo setup and this is what my project structure looks like this
api/
app/
website/
├─ src/
├─ netlify.toml
netlify.toml
package.json
yarn.lock
I have two netlify.toml
files, one at the project root which looks like this:
[build]
base = "website/"
ignore = "git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- ."
[build.environment]
NETLIFY_USE_YARN = true
YARN_VERSION = "1.22.19"
YARN_WORKSPACES = true
[[redirects]]
from = "https://xxxxxxxx.netlify.app"
to = "https://xxxxxxxx.com"
status = 301
force = true
and another one place inside the subdirectory website/ which looks like
[build]
command = "yarn build"
publish = "build"
Problem is that these aren’t working and are not even being processed, i checked the generated _redirects
file inside build folder and it didn’t contain the redirect it just had
* /.netlify/functions/render 200
Am i doing something wrong?
Only 1 netlify.toml
is processed. If you’ve set a base path in your site settings, Netlify will read the netlify.toml
from there.
Only 1 netlify.toml
is processed
Which one? and can you tell me how can i fix this
If i get rid of the root netlify.toml
, move all settings to website/netlify.toml
and set base path to website/
in site settings like you said i get build error
Failed during stage 'Reading and parsing configuration files':
...
...
...
cannot unmarshal bool into Go struct field BuildConfig.Config.build.environment of type string
After fixing build environment variable thing by wrapping boolean values under [build.environment]
in double quotes i’m now getting a different error
7:42:23 PM: Error: Redirects are not supported in netlify.toml. Use _redirects instead. For more details consult the readme's troubleshooting section.
Could you share your current toml
? That error doesn’t seem from us. Actually, your site name would be more helpful.
Ahh, i think this error is coming from netlify adapter by sveltekit [111843a]
My current netlify.toml
looks like this btw
[build]
base = 'website'
ignore = "git diff --quiet $COMMIT_REF $CACHED_COMMIT_REF -- ."
command = "yarn build"
publish = "build"
[build.environment]
NETLIFY_USE_YARN = "true"
YARN_VERSION = "1.22.19"
YARN_WORKSPACES = "true"
[[redirects]]
from = "https://xxxxxx.netlify.app"
to = "https://xxxxxx.com"
status = 301
force = true
So based on this, is it resolved, or do you still need help?
Yeah, bit hacky but i managed to fix it by committing my _redirects
file inside build
folder containing redirect rules
https://xxxxxx.netlify.app https://xxxxxx.com 301!
* /.netlify/functions/render 200