Skip to content
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

Functions not showing after deployment #599

Closed
krystofurr opened this issue Apr 23, 2024 · 11 comments
Closed

Functions not showing after deployment #599

krystofurr opened this issue Apr 23, 2024 · 11 comments

Comments

@krystofurr
Copy link

Hi there,

I started working with durable functions for a project at work and I've ran into something that I'm having difficulty troubleshooting. It seems that my project builds and executes fine locally. It also has no issue deploying to Azure it seems. But depending on whether I comment out some of the source code in some of my custom modules that are imported into activity functions...the functions in Azure show up / don't show up. I'm at a loss as to what is causing it. Obviously it seems to me that it's my custom logic but it builds and run fine locally as I mentioned.

Durable Functions Version: 4

I have 1 orchestrator, 1 http trigger client and 1 activity. Inside of the activity function I have a class that imports azure dependencies. Some of which are these:

"@azure/identity": "^4.0.1",
"@azure/storage-blob": "^12.17.0",
"@azure/storage-blob-changefeed": "^12.0.0-preview.4",
"@azure/storage-queue": "^12.16.0"

I've found if i comment out all of the logic in the class and just leave it as a skeleton basically, it deploys and shows the functions in Azure. Otherwise nothing shows. Files do get deployed because I've verified that the changes are in place. For deployment I'm using the following:

  • task: AzureFunctionApp@2
    inputs:
    connectedServiceNameARM: ${{ parameters.subscription }}
    appType: "functionAppLinux"
    appName: "my-durable_function_app-${{ parameters.env }}"
    package: "$(Pipeline.Workspace)/drop/$(Build.BuildId).zip"
    runtimeStack: 'NODE|20'
    deploymentMethod: 'runFromPackage'

Is there anywhere in Azure Portal I can see if it's successfully recognized the durable function project and will post the functions under the 'Overview / Function Tab' in Azure ? It's a very strange issue

@ejizba
Copy link
Contributor

ejizba commented Apr 23, 2024

Hi @krystofurr please take a look at these troubleshooting steps: https://learn.microsoft.com/en-us/azure/azure-functions/functions-node-troubleshoot?pivots=nodejs-model-v4

If the troubleshooting doc doesn't help, I have a few questions. Does the custom logic only have problems in Azure or does it work locally? It would be helpful to have some of your logs. If the problem reproduces locally, that would be the output of func host start. If it's only in Azure, you could either share the logs from app insights or give us your function app information with these instructions so that we can look at logs from our side

@bachuv bachuv added Needs: Author Feedback Waiting for the author of the issue to respond to a question P3 Priority 3 and removed Needs: Triage 🔍 labels Apr 23, 2024
@krystofurr
Copy link
Author

Thanks @ejizba for the response! It only has deployment problems in Azure. Seems to work fine locally when executing the client http trigger that initiates the orchestrator. I reviewed the links that you provided and here is some more insight into things.

As I mentioned above I have some other Azure dependencies...

"@azure/identity": "^4.0.1",
"@azure/storage-blob": "^12.17.0",
"@azure/storage-blob-changefeed": "^12.0.0-preview.4",
"@azure/storage-queue": "^12.16.0"

So if I comment out anything that utilizes these dependencies in the project, it seems to fail finding the runtime and then switches to test mode. See the logs below when it fails to find any functions from the KUDU console...

2024-04-24T14:42:06.674 [Warning] WARNING: Failed to detect the Azure Functions runtime. Switching "@azure/functions" package to test mode - not all features are supported.
2024-04-24T14:42:06.683 [Warning] WARNING: Skipping call to register function "activityCheckUpdate" because the "@azure/functions" package is in test mode.
2024-04-24T14:42:06.691 [Warning] WARNING: Skipping call to register function "reportParserHttpStart" because the "@azure/functions" package is in test mode.
2024-04-24T14:42:06.692 [Warning] WARNING: Skipping call to register function "reportParserOrchestrator" because the "@azure/functions" package is in test mode.
 
 
2024-04-24T14:42:07.482 [Information] Reading functions metadata (Custom)
2024-04-24T14:42:07.723 [Information] 1 functions found (Custom)
2024-04-24T14:42:07.917 [Information] 0 functions loaded
2024-04-24T14:42:08.185 [Information] Generating 0 job function(s)
2024-04-24T14:42:08.325 [Warning] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.

and logs when I uncomment lines that use those dependencies and they deploy. It finds the functions....

2024-04-24T14:43:46.780 [Information] Starting JobHost
2024-04-24T14:43:46.781 [Information] Starting Host (HostId=my-durable_function_app-dev, InstanceId=526cc336-f3bf-4b4e-8b5a-785fb2dd2d7a, Version=4.33.2.2, ProcessId=26, AppDomainId=1, InDebugMode=True, InDiagnosticMode=False, FunctionsExtensionVersion=~4)
2024-04-24T14:43:46.791 [Information] Loading functions metadata
2024-04-24T14:43:46.962 [Information] Reading functions metadata (Custom)
2024-04-24T14:43:47.051 [Information] 1 functions found (Custom)
2024-04-24T14:43:47.180 [Information] 3 functions loaded
2024-04-24T14:43:47.413 [Information] Generating 3 job function(s)
2024-04-24T14:43:47.475 [Information] Worker process started and initialized.
2024-04-24T14:43:47.715 [Information] Found the following functions:
Host.Functions.activityCheckUpdate
Host.Functions.reportParserHttpStart
Host.Functions.reportParserOrchestrator

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed Needs: Author Feedback Waiting for the author of the issue to respond to a question labels Apr 24, 2024
@ejizba
Copy link
Contributor

ejizba commented Apr 24, 2024

Okay this sounds like a known issue that was fixed a while ago. Check your package-lock.json file for the "require-in-the-middle" package and make sure it's at least v7.0.0. If not, update your dependencies until it is. Usually people don't rely on "require-in-the-middle" directly, so it can be a bit of a pain to figure out where the dependency is coming from. Our original reports of this issue (see here) were typically for people using the "applicationinsights" package, but there could be other packages depending on it, too.

@krystofurr
Copy link
Author

I can also duplicate the issue outside of my own project by using a new generated durable function project through VS Code. Steps...

  1. In VSCode choose Azure Function: Create a function
  2. Choose your folder
  3. Choose 'Typescript'
  4. Model V4
  5. Durable Functions Orchestrator
  6. Azure Storage
  7. Name for your activity

Add the following dependency to your project

"@azure/storage-blob-changefeed": "^12.0.0-preview.4"

Try to instantiate a change feed client in the activity ( It won't actually get a client without credentials, but it just being there is enough to reproduce the issue )

new BlobChangeFeedClient(`https://myStorageAccountName.blob.core.windows.net`,null);

Deploy to Azure via pipeline. Used AzureFunctionApp@2 as 'runFromPackage' or 'zipDeploy'

Deploy is successful and no functions show in Azure

@krystofurr
Copy link
Author

Okay this sounds like a known issue that was fixed a while ago. Check your package-lock.json file for the "require-in-the-middle" package and make sure it's at least v7.0.0. If not, update your dependencies until it is. Usually people don't rely on "require-in-the-middle" directly, so it can be a bit of a pain to figure out where the dependency is coming from. Our original reports of this issue (see here) were typically for people using the "applicationinsights" package, but there could be other packages depending on it, too.

I don't have this "require-in-the-middle" package in my package-lock.json. In my project or the generated one.

@ejizba
Copy link
Contributor

ejizba commented Apr 24, 2024

It's really weird that this doesn't repro locally. Can you share your app name so I can look at logs from our side? Here are steps to share it privately: https://github.com/Azure/azure-functions-host/wiki/Sharing-Your-Function-App-name-privately

@krystofurr
Copy link
Author

Unfortunately I can't share the app name. You can generate a blank application , go through the steps and try deploying it. That should provide the logs you need ?

@ejizba
Copy link
Contributor

ejizba commented Apr 24, 2024

I tried your steps except deploying through VS Code and it worked just fine. This kind of error should be reproducible locally, so the fact that you can't do that makes me think it's a problem with your Azure Pipeline or the app itself in Azure

@krystofurr
Copy link
Author

Well something worked today. A team member saw this in the logs

image

So the 'applicationinsights' dependency wasn't part of the project. After adding it ( ensuring that it was ^2.7.1 ) and redeploying, it deploys fine now. Any idea why ?

@ejizba
Copy link
Contributor

ejizba commented Apr 25, 2024

I would double check to make sure you're committing your package-lock.json file to git (or yarn.lock if you're using yarn, etc.). These files should not be in your gitignore. Also in your pipeline, make sure you run npm ci instead of npm install (details on the differences here). I'm guessing your problem was a difference in dependencies in your local vs your pipeline, and these recommendations are designed to ensure they are the exact same.

@krystofurr
Copy link
Author

Thanks for your help on this. Much appreciated.

@ejizba ejizba closed this as completed Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants