-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't publish my Azure function that I made as part of a monorepo #40
Comments
Hi @ChristianOConnor , It seems to me like there are 2 main issues here.
Sorry that I can't be more of a help here. If you find more details, I'll be happy to help you further. |
@AlexPshul I made an example repo that illustrates my problem. I invited you as a collaborator. Please pull the code to see what I'm talking about https://github.com/ChristianOConnor/monorepo-publish-function-example . You can run the app just fine by running
As you can see, no functions were uploaded to my Azure account. Can you please help me identify the problem? |
Your repo looks like the minimum configuration, which is great for testing and making sure that the issue is not in the code, but in your cloud configuration. You could also check the logs if you connected application insights to your function app resource. |
@AlexPshul I've been testing this repo against my issue and I have realized that it's not my Azure configuration. The Azure extension scaffolds correct and operations Azure functions but @nxazure/func function scaffolded in a NX monorepo don't work. I've tried to make it as testable and replicate-able as possible. Here is a normal Azure function scaffolded with the Azure VSCode extension: https://github.com/ChristianOConnor/normalrepo-publish-function-example . Here is a monorepo with 1 Azure function scaffolded through @nxazure/func commands: https://github.com/ChristianOConnor/monorepo-publish-function-example . To build and publish the normal Azure function:
This SHOULD WORK. It worked for me when I tested it. This is what the output looks like in my powershell window.
To build and publish the @nxazure/func scaffolded function:
This WILL NOT work. It simply uploads and empty 0 function payload. This is what the output looks like in my powershell window.
As you can see, no functions are uploaded. The payload is only 4.99 KB and there is no http trigger link below Conclusion: |
@AlexPshul Oh amazing this worked for me! Thank you so much! |
This issue is gathering dust because it has been open for 30 days with no activity. Time to wake up or be swept away! |
I want to comment of the workaround with not using workspaces:
I am not using workspaces in my nx project but I still encounter the issue. Is there a fix for it? |
@nachevnikolay If you are able to reproduce the issue in a repo on the side, I'd be happy to give it a go and see what's up. |
Everything works until I get to the deploy step. First I ran this:
I created my monorepo which consisted of 2 typescript Azure functions and 1 C# MVC app.
I made the Azure function in question with these commands:
I can run and build my function locally just fine. I ran
az functionapp create --resource-group RESOURCE_GROUP_NAME --consumption-plan-location LOCATION_CODE --runtime node --name FUNCTION_AZURE_NAME --storage-account STORAGE_ACCOUNT_NAME --os-type Linux
to create the Azure function app in my azure portal on my actual Azure account.My nx repo's root package.json has these scripts:
Build and start both work. This is my azure function's project.json file:
And I never get an error when I try to run publish, but also no function was actually uploaded:
It looks like the publish command is building my C# app instead of my Azure function? As I stated previously my repo contains 2 Azure Functions and 1 C# MVC app. The publish command clearly calls out to the proper Azure Function directory. What am I doing wrong?
The text was updated successfully, but these errors were encountered: