I have a Node.js Azure Function in TypeScript. When I deploy, it takes like 25 minutes to deploy.
Those are pretty basic functions with Prisma ORM. Building locally takes couple seconds only.
Is that normal? I also have the WEBSITE_RUN_FROM_PACKAGE = 1
in my Azure Function configuration.
Here are my project dependencies in my package.json
:
"dependencies": {
"@azure/functions": "^4.0.0",
"@prisma/client": "5.6.0",
"crypto": "^1.0.1",
"jsonwebtoken": "^9.0.2",
"prisma": "^5.6.0"
},
"devDependencies": {
"@types/node": "18.x",
"concurrently": "^8.2.2",
"rimraf": "^5.0.0",
"typescript": "^4.0.0"
}
2
Answers
Add Application Setting
WEBSITE_RUN_FROM_PACKAGE=1
in the Function App’s Configuration before deploying the function app.Application Settings of my Function App:
If you still face delay in deployment, use Run from Package deployment. (with the setting
WEBSITE_RUN_FROM_PACKAGE=<storage_url>
) or Bundle your node_modules with WebPack.Refer MSDOC.
References:
The problem is likely caused by the new yaml Github Actions that are automatically generated by Azure, which first build, upload, and then download the artifact in the next step to actually deploy it.
This new yaml deployment template is useful when Azure fails to deploy even though your build is correct. My recommendation is to use the ‘old’ deployment method that does not upload the artifact to any storage rather than the Azure method.