netlify-plugin-inline-functions-env icon indicating copy to clipboard operation
netlify-plugin-inline-functions-env copied to clipboard

Build failing: "Error: Failed to inline function files because netlify function folder was not configured or pointed to a wrong folder, please check your configuration"

Open antitheos opened this issue 3 years ago • 3 comments

our build process starting failing this afternoon with message Error: Failed to inline function files because netlify function folder was not configured or pointed to a wrong folder, please check your configuration

this build has been running successfully for about a month this is failing even with following settings _ function folder set in netlify.toml _ function folder set in ui _ function folder left blank, defaults to netlify/functions

running [email protected] here its the output from the build 3:52:32 PM: 2. onPreBuild command from netlify-plugin-inline-functions-env
3:52:32 PM: ────────────────────────────────────────────────────────────────── 3:52:32 PM: ​ 3:52:32 PM: build env contains the following environment variables [ 3:52:32 PM: 'FORCE_COLOR', 3:52:32 PM: 'NVM_INC', 3:52:32 PM: 'GIMME_CGO_ENABLED', 3:52:32 PM: 'NODE_VERSION', 3:52:32 PM: 'UAT_MULESOFT_KEY', 3:52:32 PM: 'rvm_bin_path', 3:52:32 PM: 'SENDGRID_API_KEY', 3:52:32 PM: 'MULESOFT_HOST', 3:52:32 PM: 'GEM_HOME', 3:52:32 PM: 'NVM_CD_FLAGS', 3:52:32 PM: 'SWIFTENV_ROOT', 3:52:32 PM: 'MASTER_EnvironmentName', 3:52:32 PM: 'FR_SAML_COOKIE', 3:52:32 PM: 'host', 3:52:32 PM: 'cert', 3:52:32 PM: 'UAT_entryPoint', 3:52:32 PM: 'IRBRC', 3:52:32 PM: 'PIPENV_VENV_IN_PROJECT', 3:52:32 PM: 'UAT_FR_SAML_AUTH_KEY', 3:52:32 PM: 'UAT_EnvironmentName', 3:52:32 PM: 'GIMME_TYPE', 3:52:32 PM: 'MASTER_cert', 3:52:32 PM: 'MASTER_entryPoint', 3:52:32 PM: 'OLDPWD', 3:52:32 PM: 'MY_RUBY_HOME', 3:52:32 PM: 'EnvironmentName', 3:52:32 PM: 'NETLIFY_IMAGES_CDN_DOMAIN', 3:52:32 PM: 'LC_ALL', 3:52:32 PM: 'SERVICENOW_HOST', 3:52:32 PM: 'BRANCH', 3:52:32 PM: 'MASTER_FR_SAML_COOKIE', 3:52:32 PM: 'CYPRESS_CACHE_FOLDER', 3:52:32 PM: 'NVM_DIR', 3:52:32 PM: 'UAT_FR_SAML_LINK', 3:52:32 PM: 'UAT_host', 3:52:32 PM: 'UAT_MULESOFT_HOST', 3:52:32 PM: 'CUSTOM_RUBY', 3:52:32 PM: 'rvm_path', 3:52:32 PM: 'RVM_DIR', 3:52:32 PM: 'FR_SAML_AUTH_KEY', 3:52:32 PM: 'publicCert', 3:52:32 PM: 'NEXT_TELEMETRY_DISABLED', 3:52:32 PM: 'HEAD', 3:52:32 PM: 'GATSBY_TELEMETRY_DISABLED', 3:52:32 PM: 'VIRTUAL_ENV', 3:52:32 PM: 'GIMME_NO_ENV_ALIAS', 3:52:32 PM: 'NETLIFY_BUILD_BASE', 3:52:32 PM: 'SERVICENOW_HOST_GLIDE_SSO_ID', 3:52:32 PM: 'SITE_ID', 3:52:32 PM: 'UAT_SERVICENOW_HOST', 3:52:32 PM: 'rvm_prefix', 3:52:32 PM: 'FRSignInOnly', 3:52:32 PM: 'CACHED_COMMIT_REF', 3:52:32 PM: 'PATH', 3:52:32 PM: 'PIPENV_DEFAULT_PYTHON_VERSION', 3:52:32 PM: 'DEPLOY_URL', 3:52:32 PM: 'PIPENV_RUNTIME', 3:52:32 PM: 'PWD', 3:52:32 PM: 'CONTEXT', 3:52:32 PM: 'DEPLOY_ID', 3:52:32 PM: 'LANG', 3:52:32 PM: 'JAVA_VERSION', 3:52:32 PM: 'NETLIFY_SUBSTAGE_TIMES', 3:52:32 PM: 'privateKey', 3:52:32 PM: 'MASTER_host', 3:52:32 PM: 'PS1', 3:52:32 PM: 'BUILD_ID', 3:52:32 PM: 'TWILIO_ACCOUNT_SID', 3:52:32 PM: 'URL', 3:52:32 PM: 'rvm_version', 3:52:32 PM: 'UAT_FR_SAML_COOKIE', 3:52:32 PM: 'rvm_pretty_print_flag', 3:52:32 PM: 'SHLVL', 3:52:32 PM: 'SENDGRID_API_SENDER', 3:52:32 PM: 'HOME', 3:52:32 PM: 'GOROOT', 3:52:32 PM: 'entryPoint', 3:52:32 PM: 'LANGUAGE', 3:52:32 PM: 'YARN_VERSION', 3:52:32 PM: 'rvm_ruby_string', 3:52:32 PM: 'CI', 3:52:32 PM: 'GIMME_GO_VERSION', 3:52:32 PM: 'MULESOFT_KEY', 3:52:32 PM: 'FR_SAML_LINK', 3:52:32 PM: 'MASTER_FR_SAML_AUTH_KEY', 3:52:32 PM: 'TWILIO_AUTH_PHONE_NUMBER', 3:52:32 PM: 'MASTER_BOLD_KB', 3:52:32 PM: 'GOCACHE', 3:52:32 PM: 'GEM_PATH', 3:52:32 PM: 'REPOSITORY_URL', 3:52:32 PM: 'NVM_BIN', 3:52:32 PM: 'DEPLOY_PRIME_URL', 3:52:32 PM: 'UAT_cert', 3:52:32 PM: 'GOPATH', 3:52:32 PM: 'UAT_BOLD_KB', 3:52:32 PM: 'SENDGRID_API_SENDER_NAME', 3:52:32 PM: 'rvm_delete_flag', 3:52:32 PM: 'GIMME_ENV_PREFIX', 3:52:32 PM: 'PULL_REQUEST', 3:52:32 PM: 'rvm_recommended_ruby', 3:52:32 PM: ... 9 more items 3:52:32 PM: ] 3:52:33 PM: ​ 3:52:33 PM: ──────────────────────────────────────────────────────────────── 3:52:33 PM: Plugin "netlify-plugin-inline-functions-env" failed
3:52:33 PM: ──────────────────────────────────────────────────────────────── 3:52:33 PM: ​ 3:52:33 PM: Error message 3:52:33 PM: Error: Failed to inline function files because netlify function folder was not configured or pointed to a wrong folder, please check your configuration 3:52:33 PM: ​ 3:52:33 PM: Plugin details 3:52:33 PM: Package: netlify-plugin-inline-functions-env 3:52:33 PM: Version: 1.0.9 3:52:33 PM: npm link: https://www.npmjs.com/package/netlify-plugin-inline-functions-env 3:52:33 PM: Report issues: https://github.com/bencao/netlify-plugin-inline-functions-env/issues 3:52:33 PM: ​ 3:52:33 PM: Error location 3:52:33 PM: In "onPreBuild" event in "netlify-plugin-inline-functions-env" from netlify.toml and package.json 3:52:33 PM: at processFiles (/node_modules/netlify-plugin-inline-functions-env/index.js:38:24) 3:52:33 PM: ​ 3:52:33 PM: Resolved config 3:52:33 PM: build: 3:52:33 PM: base: /opt/build/repo 3:52:33 PM: command: npm run generate 3:52:33 PM: commandOrigin: config 3:52:33 PM: environment: 3:52:33 PM: - ..... 3:52:33 PM: processing: 3:52:33 PM: css: 3:52:33 PM: bundle: true 3:52:33 PM: minify: true 3:52:33 PM: html: 3:52:33 PM: pretty_urls: true 3:52:33 PM: images: 3:52:33 PM: compress: true 3:52:33 PM: js: 3:52:33 PM: bundle: true 3:52:33 PM: minify: true 3:52:33 PM: skip_processing: false 3:52:33 PM: publish: /opt/build/repo/dist 3:52:33 PM: publishOrigin: config 3:52:33 PM: functions: 3:52:33 PM: '*': {} 3:52:33 PM: functionsDirectory: /opt/build/repo/netlify/functions plugins: - inputs: {} origin: config package: netlify-plugin-contextual-env - inputs: {} origin: config package: netlify-plugin-inline-functions-env Caching artifacts

antitheos avatar Jun 25 '21 20:06 antitheos

after more testing seems this was caused by have files in a subfolder had js files in folder /netlify/function/utils/config after removing those files the error went away. may be just need to update error messaging

antitheos avatar Jun 25 '21 20:06 antitheos

Thank you for reporting issues and we'll look into the code to see whether error messages can be improved.

bencao avatar Jul 16 '21 02:07 bencao

@bencao One thing that might help is to display different error messages for these two situations:

  1. the functions/ directory can't be found,
  2. the functions' dependencies are not installed.

I just ran across this because I'd forgotten to run npm i in my functions directory :facepalm:. The error message was confusing because the functions directory was present and correctly identified in netlify.toml.

ctorgalson avatar Feb 21 '22 10:02 ctorgalson