-
Notifications
You must be signed in to change notification settings - Fork 267
Description
Context
Azd does remote build by default when deploying a Node Function app. Azd also runs npm install and build automatically. These two actions lead to failed deployments if the user tries to deploy the app on a Windows machine. The reason is the following. The generated node_modules/ directory from the install and build step gets included as part of the deployment payload. During deployment, remote build (running on Oryx) tries to run the typescript package inside the directory but that package doesn't work for Linux, so the user gets an Oryx error and deployment fails.
Workaround and problems
Node users need include node_modules/ in .funcignore so that it's excluded during project packaging; remote build will generate a new node_modules/. This workaround isn't ideal because users would have to know the internals of Function app deployment to know this.
This workaround also doesn't address a bigger problem, which is other clients like VSCode don't turn on remote build by default, so users wouldn't have to include node_modules/ in .funcignore. This means depending on how they're deploying the function app, they need different .funcignores, making it difficult to switch between clients.
Ask
- Keep the default today, i.e. remote build is on, for backwards compat purposes but support specifying
remoteBuildin azure.yaml for turning it off:services: api: project: . language: js host: function remoteBuild: false | true
How this helps customers: Functions Node customers deploying with azd would specify remoteBuild:false in azure.yaml if they've already built the project locally (perhaps for local testing). If they later switch to another client like VSCode, they can keep the same .funcignore for successful deployment.
- Support skipping npm install and run when remote build is on with
packageOnly:services: api: project: . language: js host: function packageOnly: true | false
How this helps customers: For customers that just clone the Function sample and immediately deploy, thepackageOnly: true lets remote build in Oryx run npm install/build, ensuring that the right node_modules/ is generated for deployment.