Skip to content

Conversation

@khendrikse
Copy link
Contributor

@khendrikse khendrikse commented Oct 21, 2025

Summary

When running netlify init to set up a new project (one that hasn't been configured in your Netlify account yet), the CLI was sending an absolute path for the functions directory to Netlify's API instead of a relative path.

If you initialized a project on your local machine at:

/Users/foo/Projects/Work/project-1/

The functions directory would be sent to Netlify as:

/Users/foo/Projects/Work/project-1/netlify/functions

Instead of the correct relative path:

netlify/functions

Root Cause

The issue was in src/utils/init/utils.ts where the config.build.functions value (which comes from @netlify/config package and is resolved to an absolute path) was being used directly without converting it to a relative path before sending it to the Netlify API. The fix ensures that any absolute paths are converted to paths relative to the repository root before being sent to the API, so they work correctly in any build environment.


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@khendrikse khendrikse requested a review from a team as a code owner October 21, 2025 13:29
@github-actions
Copy link

github-actions bot commented Oct 21, 2025

📊 Benchmark results

Comparing with 9ae17b5

  • Dependency count: 1,029 (no change)
  • Package size: 284 MB (no change)
  • Number of ts-expect-error directives: 379 (no change)

@khendrikse khendrikse merged commit f40c6bd into main Oct 24, 2025
67 of 68 checks passed
@khendrikse khendrikse deleted the EX-1062/use-relative-path-netlify-init branch October 24, 2025 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants