Command `netlify build` does not validate plugin inputs

Hey :wave:

while working on this build plugin, I ran into an input "x" for plugin "./index.js" error at deploy time, that I could not reproduce locally. It seems that when running netlify build, the build config passed to the plugin is not validated against the inputs list specified in the plugin manifest.yml file.

To reproduce, simply remove an input argument from the manifest and notice that netlify build still runs the plugin correctly.

Can you confirm?

In any case, it’s definitely not a big deal but this post will maybe help someone debugging :v:

Hi @hypervillain,

Plugin inputs are optional by default. required: true can be used to make them required:

name: netlify-plugin-search-index
  - name: generatedFunctionName
    required: true

Please let me know if I understood your question correctly.

Eh Micky :wave:

it’s not exactly the problem I encountered. None of the inputs defined there have a required property. My build rather failed on Netlify because it used an input that was not defined in my manifest. However, when running netlify build command, I was able to bundle my project locally.

If I understand correctly, the purpose of such build command is to mimic the behaviour of builds as they would happen remotely. At the moment, it seems it ignores the inputs declared in the manifest.

So, I’m reporting this to explain that the Netlify CLI (or its internal build package) maybe does not check required inputs, when ran locally. Hope it clears things up :blush:

Oh thanks for explaining, I did not understand it.

Just to make sure I totally understand it now: your plugin has a manifest.yml. When users are specifying an unknown input (for example mispeling the name of an input), it should throw an error. It does it in production builds, but not in Netlify CLI builds (netlify build command). Is that correct?

I this is the case, I think installing netlify-cli@2.47.0 might solve your problem there. Please let me know.

Hello again @ehmicky,

yes, that was exactly my problem and updating the CLI solved it (plus a bunch of other minor bugs)!
Thank you again for your time :+1: