Skip to content

netlify.toml written at "postinstall" not detected by @netlify/build #3413

@juanpprieto

Description

@juanpprieto

Describe the bug
Hi team. not sure if this is the correct place, but I hope I can find some pointers. Link to issue on the support forum.

As the title says, I am trying to inject a netlify.toml which includes custom plugins before netlify/build, but it doesn't seem to be detected (i.e looks like its too late for it)

I'm doing this because I want to stop endusers from being able to modify the TOML and because I don't want the file to be tracked in git so that the endusers dont have to know the inner workings of our product.

Is there any way to write/inject a netlify.toml before the netlify build / config sequence kicks in?

Configuration

"postinstall" script - writes our custom netlify.toml to the root folder i.e /opt/build/repo

"postinstall": "node --eval \"require('@my-org/netlify-toml')\""

Deploy logs

7:39:51 AM: [5/5] Building fresh packages...
7:39:57 AM: $ node --eval "require('@myorg/netlify-toml')"
7:39:59 AM: Created default netlify.toml at /opt/build/repo <------ ✅
7:39:59 AM: Done in 61.65s.
7:39:59 AM: NPM modules installed using Yarn
7:39:59 AM: Started restoring cached go cache
7:39:59 AM: Finished restoring cached go cache
7:39:59 AM: go version go1.14.4 linux/amd64
7:39:59 AM: go version go1.14.4 linux/amd64
7:39:59 AM: Installing missing commands
7:39:59 AM: Verify run directory
7:40:00 AM: ​
7:40:00 AM: ────────────────────────────────────────────────────────
7:40:00 AM:   Netlify Build                                                 
7:40:00 AM: ────────────────────────────────────────────────────────
7:40:00 AM: ​
7:40:00 AM: ❯ Version
7:40:00 AM:   @netlify/build 17.9.2
7:40:00 AM: ​
7:40:00 AM: ❯ Flags
7:40:00 AM:   baseRelDir: true
7:40:00 AM:   deployId: 61128f70de851d43819b2cb8
7:40:00 AM: ​
7:40:00 AM: ❯ Current directory
7:40:00 AM:   /opt/build/repo
7:40:00 AM: ​
7:40:00 AM: ❯ Config file <--- 🚫 Not detecting the netlify.toml we just wrote
7:40:00 AM:   No config file was defined: using default values.
7:40:00 AM: ​
7:40:00 AM: ❯ Context
7:40:00 AM:   production
7:40:00 AM: ​
7:40:00 AM: ❯ Loading plugins <---- 🚫 Not detecting our netlify.toml build plugins
7:40:00 AM:    - @netlify/plugin-nextjs@3.8.0 from Netlify app and package.

*Deploy Log
Full failing deploy logs @ deploy id 611316d8bda9b800087268ff

Metadata

Metadata

Assignees

No one assigned

    Labels

    staletype: featurecode contributing to the implementation of a feature and/or user facing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions