I'm working on an API that uses azure functions which gets deployed to an azure static web app using https://github.com/Azure/static-web-apps-deploy. I want to restructure my api side in order to separate my source files from my build files, but my functions are not being deployed correctly.
Currently, the API side has the following directory structure:
/api/node_modules
/api/dist
/api/coverage
/api/* (a mix of src and config json files)
I'm trying to create a /api/src folder and move all of the azure functions into it so that the api folder now has just:
/api/node_modules
/api/dist
/api/coverage
/api/src (contains azure functions)
/api/*.json (config json files only - e.g. package.json, typedoc.json, .eslintrc.json, etc)
Once I added the src folder the functions were no longer getting deployed correctly. The web app would 404 trying to find the routes.
Here is what I've tried so far:
- Updating the function.json scriptFile to point to the script using /src/MyFunction/index.js
- Updating tsconfig include to include src files
- Updating the github action to point to api/src instead of just api
- Ensuring the host.json file is in the src directory
An example repo of the concept can be found at https://github.com/sinedied/azure-swag. For my repo I have more azure functions, but it's the same concept. I would be trying to move the quote function into a src folder then deploying the functions.
Any help is appreciated!
Edit: After trying to replicate the issue, I wasn't able to reproduce it on the azure-swag repo by just moving the functions. I believe it could have to do with the fact my repo is in typescript. I was able to reproduce the repo at the following repo: https://github.com/avenmia/test-deployment
The azure functions currently 503 when being requested, but when I add a scriptFile and point it to the index.js for the function then it gives me the 404 for my original project.