Azure / Azure/azure-functions-host
Prevent npm install for JavaScript functions
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
We are attempting to use puppeteer in an Azure Function to produce PDFs using Chromium. We have a mono-repo setup that uses `yarn` to manage dependencies and we need to install puppeteer along with a `package.json` file in production in order for `puppeteer` to pick up the Chromium install.
The problem is that according to [this documentation](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node#dependency-management) Azure Functions will run npm install automatically when it detects a `package.json` file, but because we are using yarn to manage dependencies this install will not respect the `yarn.lock` file version hashes.
We are easily able to do the install deterministically during our build process, but we need to have the `package.json` file alongside the project in order for puppeteer to find the chromium install. This in turn triggers an `npm install` during deploy which will install our dependency, but not in a deterministic way as it does not know about `yarn.lock`.
Is there a way to prevent Azure Function deployments from triggering `npm install` even when there is a package.json present?
Contributor guide
Research direction
No repository file, test, or entry point is named. Start with the linked Azure Functions dependency-management documentation and trace how deployments detect package.json and invoke npm install. Done means deployments can skip the automatic npm install while retaining package.json so Puppeteer can find its Chromium installation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, javascript
- Domain
- cloud, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100