Impossible to deploy API if build manual (skip_build_*)
- Dominant language
- No language data
- Stars
- 346
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Impossible to deploy a static web app composed of an app and an api (managed function).
Also, the documentation is lying. Yes it does and i give further information later.
Notice that it works great when deploying with pipeline and let the pipline build the app and api.
But if I ever want to deploy manually my api, it's impossible to find how to achieve this.
I've red all documentations, tried a lot of things.
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. create a new repo
2. func init
3. add a hello api
4. either swa deploy or pipeline with skip_build_app and skip_build_api to true
### swa-manual
[repo swa-manual](https://github.com/nk54/swa-manual)
The swa-manual repo is configured to deploy a static web app with swa cli (locally)
I use swa deploy.
My functions are deployed : i see them in the azure portal.
But if I try to access the URL it throws a 500.
### swa-pipeline
[repo swa-pipeline](https://github.com/nk54/swa-pipeline)
The swa-pipeline repo is configured to deploy a static web app with azure pipeline.
My functions are deployed : i see them in the azure portal.
But if I try to access the URL it throws a 500.
This pipeline has a parameter to set up on run : "build manual / auto"
### Where the documentation is lying
It says in the documentation that in v4 template you don't need function.json, you don't care about the structure of files.
It's true but ONLY IF you let the hand on the build and rely on GitHub Action / ADO Pipeline to do the job.
I didn't find in reddit, in stackoverflow, with cursor, with copilot, a way to have a hello world project working.
I've lost many days trying to find out how to make it work.
I could rely on build auto. But this poc was a way for me to find how to deploy manually so i can use pnpm and shared library, monorepo etc. It doesn't work with auto build because you don't have a way to build in oryx the dependencies. That's why i wanted to find how to do it with a very simple case so I can adapt later on my real project.
The documentation tells you your main entrypoint in package json could be something like "dist/{folder/index.js,other/index.js}" or dist/**/*.js} but setting a value always ends up with this error (with MANUAL deploy) (and yes i've checked my dist folder countless times)
Result: Failure Exception: Worker was unable to load entry point "dist/{hello/index.js,hi/index.js}": Found zero files matching the supplied pattern.
If i remove the main entrypoint, i got this
Exception while executing function: Functions.users Result: Failure
Exception: Worker was unable to load function users: 'Cannot find module '@azure/functions'
Require stack:
- /home/site/wwwroot/users/index.js
- /azure-functions-host/workers/node/dist/src/worker-bundle.js
- /azure-functions-host/workers/node/dist/src/nodejsWorker.js'
Stack: Error: Worker was unable to load function users: 'Cannot find module '@azure/functions'
Require stack:
- /home/site/wwwroot/users/index.js
- /azure-functions-host/workers/node/dist/src/worker-bundle.js
- /azure-functions-host/workers/node/dist/src/nodejsWorker.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1212:15)
at Module._load (node:internal/modules/cjs/loader:1043:27)
at Module.require (node:internal/modules/cjs/loader:1298:19)
But this is the only dependency i have in my package.json... How is it not found?
The documentation in github with all the samples doesn't have an exemple on how to deploy manually : all expect the usage of github action.
It is a nightmare to find how to deploy by hand a static web app with an embedded managed function.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.