-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Hey team!
I am in the process of automating my monorepo's deployment, up until now I have used Visual Studio codes inbuilt support for deploying to azure function, this process does npn install && npm run build basically. However I am using pnpm's workspace feature as I plan on sharing my backend validation with my frontend via a shared package that both can import.
The issue here is when I try to use pnpm install and pnpm run build, it results in a node_modules folder being created outside of the folder which contains my Azure Functions and thus my package: ./app/backend I can only assume will now miss the node_modules located in my pnpm store (it's centralised on the build machine and use sym links im pretty sure)
I would love to provide more info on the exact issue that the azure function ran into when built via pnpm, but the issue is cryptic giving me only:
Exception while executing function: Functions.Upload Result: Failure
Exception: Worker was unable to load function Upload: 'Unexpected token '.''
Stack: /home/site/wwwroot/node_modules/parse-multipart:1
../../../node_modules/.pnpm/parse-multipart@1.0.4/node_modules/parse-multipart
^
SyntaxError: Unexpected token '.'
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1084:15)
at Module._compile (node:internal/modules/cjs/loader:1119:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at Object.apply (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:42034)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/home/site/wwwroot/dist/Upload/index.js:12:19)
I have tried pnpm i --shamefully-flatten --force however this for whatever reason also didn't work either ;(
Has anyone managed to get pnpm in workspaces working for azure functions + this github actions? Heres a guy with what looks like a similar issue https://stackoverflow.com/questions/74944668/how-to-deploy-azure-function-with-pnpm-and-rush