Closed jocortems closed 1 year ago
Thanks for informing will check and update you.
which doc you referring pls share the link
@bhagyshricompany I am referring to the Azure China Developer Guide - https://learn.microsoft.com/en-us/azure/china/resources-developer-guide#application-insights
Codeless agent/extension based monitoring for Azure App Services is currently not supported. Snapshot Debugger is also not currently available.
I've successfully initialize Python Azure Functions with that requirements.txt, so I am unable to reproduce the issue. That error message does not come from the extension. So, I think there must be something else going wrong. I would reexamine the assumption that adding this extension package is the only thing changing.
EDIT: I tried to reproduce the issue in the US. So, it's possible that there is some China-specific issue with Functions. I doubt that, but you could open a ticket with the functions team.
@bhagyshricompany @jeremydvoss, wanted to follow up on this and see if you've had a chance to test this in China.
@jeremydvoss pls comment
"Running pip install -r requirements.txt followed by phyton3.9 func.py directly from shell within the function worker works perfectly fine, the issue only seems to be when deploying using Azure Core tools with func azure functionapp publish avx-controller-functionapp --build remote --python"
Given that our code is not being run and can also be installed successful, it seems that this is an issue on the function's side. Is functions doing something different than "pip install -r requirements.txt"?
I am having the same problem in West US. I'm deploying the Azure function from Azure DevOps using this inline script: func azure functionapp publish chuckazfuncpocfaD01
. This is the deployment log when I included opencensus-ext-azure:
2023-07-12T08:38:16.7341246Z ##[section]Starting: Deploy Azure Function
2023-07-12T08:38:16.7346236Z ==============================================================================
2023-07-12T08:38:16.7346370Z Task : Azure CLI
2023-07-12T08:38:16.7346438Z Description : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent.
2023-07-12T08:38:16.7346650Z Version : 2.223.0
2023-07-12T08:38:16.7346712Z Author : Microsoft Corporation
2023-07-12T08:38:16.7346785Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
2023-07-12T08:38:16.7346892Z ==============================================================================
2023-07-12T08:38:17.1238913Z [command]/usr/bin/az --version
2023-07-12T08:38:18.7321003Z WARNING: You have 2 update(s) available. Consider updating your CLI installation with 'az upgrade'
2023-07-12T08:38:18.7321731Z azure-cli 2.49.0 *
2023-07-12T08:38:18.7323282Z
2023-07-12T08:38:18.7323635Z core 2.49.0 *
2023-07-12T08:38:18.7323924Z telemetry 1.0.8
2023-07-12T08:38:18.7324155Z
2023-07-12T08:38:18.7372776Z Extensions:
2023-07-12T08:38:18.7373154Z azure-devops 0.26.0
2023-07-12T08:38:18.7373224Z
2023-07-12T08:38:18.7373356Z Dependencies:
2023-07-12T08:38:18.7373488Z msal 1.20.0
2023-07-12T08:38:18.7373701Z azure-mgmt-resource 22.0.0
2023-07-12T08:38:18.7373772Z
2023-07-12T08:38:18.7373972Z Python location '/opt/az/bin/python3'
2023-07-12T08:38:18.7374203Z Extensions directory '/opt/az/azcliextensions'
2023-07-12T08:38:18.7374301Z
2023-07-12T08:38:18.7374504Z Python (Linux) 3.10.10 (main, May 19 2023, 08:20:31) [GCC 11.3.0]
2023-07-12T08:38:18.7374626Z
2023-07-12T08:38:18.7374772Z Legal docs and information: aka.ms/AzureCliLegal
2023-07-12T08:38:18.7374890Z
2023-07-12T08:38:18.7374934Z
2023-07-12T08:38:18.7375983Z Setting AZURE_CONFIG_DIR env variable to: /home/vsts/work/_temp/.azclitask
2023-07-12T08:38:18.7376608Z Setting active cloud to: AzureCloud
2023-07-12T08:38:18.7380101Z [command]/usr/bin/az cloud set -n AzureCloud
2023-07-12T08:38:24.4512119Z [command]/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command . '/home/vsts/work/_temp/azureclitaskscript1689151097108.ps1'
2023-07-12T08:38:28.0422070Z Getting site publishing info...
2023-07-12T08:38:28.0453009Z Creating archive for current directory...
2023-07-12T08:38:28.0484022Z Performing remote build for functions project.
2023-07-12T08:38:29.6488156Z Uploading 7.15 KB []Remote build in progress, please wait...
2023-07-12T08:38:43.3239103Z Updating submodules.
2023-07-12T08:38:43.3239989Z Preparing deployment for commit id '3277beef-3'.
2023-07-12T08:38:43.3240332Z PreDeployment: context.CleanOutputPath False
2023-07-12T08:38:43.3241041Z PreDeployment: context.OutputPath /home/site/wwwroot
2023-07-12T08:38:43.3241378Z Repository path is /tmp/zipdeploy/extracted
2023-07-12T08:38:43.3241664Z Running oryx build...
2023-07-12T08:38:43.3242293Z Command: oryx build /tmp/zipdeploy/extracted -o /tmp/build/expressbuild --platform python --platform-version 3.10.4 -i /tmp/8db82b361ed0273 -p packagedir=.python_packages/lib/site-packages
2023-07-12T08:38:43.3242758Z Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
2023-07-12T08:38:43.3243110Z You can report issues at https://github.com/Microsoft/Oryx/issues
2023-07-12T08:38:43.3243307Z
2023-07-12T08:38:43.3243639Z Oryx Version: 0.2.20230508.1, Commit: 7fe2bf39b357dd68572b438a85ca50b5ecfb4592, ReleaseTagName: 20230508.1
2023-07-12T08:38:43.3243878Z
2023-07-12T08:38:43.3244136Z Build Operation ID: dc9a5bd25a4b913e
2023-07-12T08:38:43.3244548Z Repository Commit : 3277beef-3c5a-4fe4-a3cb-cd9349d1b3ce
2023-07-12T08:38:43.3244855Z OS Type : bullseye
2023-07-12T08:38:43.3245128Z Image Type : githubactions
2023-07-12T08:38:43.3245298Z
2023-07-12T08:38:43.3245539Z Detecting platforms...
2023-07-12T08:38:43.3245937Z Platform 'hugo' has been disabled, so skipping detection for it.
2023-07-12T08:38:43.3246250Z Detected following platforms:
2023-07-12T08:38:43.3246503Z python: 3.10.4
2023-07-12T08:38:43.3246673Z
2023-07-12T08:38:43.3247012Z Using intermediate directory '/tmp/8db82b361ed0273'.
2023-07-12T08:38:43.3247217Z
2023-07-12T08:38:43.3247469Z Copying files to the intermediate directory...
2023-07-12T08:38:43.3247749Z Done in 0 sec(s).
2023-07-12T08:38:43.3247903Z
2023-07-12T08:38:43.3248168Z Source directory : /tmp/8db82b361ed0273
2023-07-12T08:38:43.3248471Z Destination directory: /tmp/build/expressbuild
2023-07-12T08:38:43.3248652Z
2023-07-12T08:38:43.3248932Z Python Version: /tmp/oryx/platforms/python/3.10.4/bin/python3.10
2023-07-12T08:38:43.3249261Z Creating directory for command manifest file if it does not exist
2023-07-12T08:38:43.3249573Z Removing existing manifest file
2023-07-12T08:38:43.3249761Z
2023-07-12T08:38:43.3249989Z Running pip install...
2023-07-12T08:39:16.6856650Z Done in 32 sec(s).
2023-07-12T08:39:16.6857214Z [08:38:44+0000] Collecting azure-functions
2023-07-12T08:39:16.6857593Z [08:38:44+0000] Using cached azure_functions-1.15.0-py3-none-any.whl (165 kB)
2023-07-12T08:39:16.6857929Z [08:38:44+0000] Collecting opencensus-ext-azure
2023-07-12T08:39:16.6858296Z [08:38:44+0000] Using cached opencensus_ext_azure-1.1.9-py2.py3-none-any.whl (43 kB)
2023-07-12T08:39:16.6858654Z [08:38:44+0000] Collecting azure-identity<2.0.0,>=1.5.0
2023-07-12T08:39:16.6859026Z [08:38:44+0000] Using cached azure_identity-1.13.0-py3-none-any.whl (151 kB)
2023-07-12T08:39:16.6859266Z [08:38:45+0000] Collecting requests>=2.19.0
2023-07-12T08:39:16.6859612Z [08:38:45+0000] Using cached requests-2.31.0-py3-none-any.whl (62 kB)
2023-07-12T08:39:16.6859868Z [08:38:45+0000] Collecting opencensus<1.0.0,>=0.11.2
2023-07-12T08:39:16.6860251Z [08:38:45+0000] Using cached opencensus-0.11.2-py2.py3-none-any.whl (128 kB)
2023-07-12T08:39:16.6860846Z [08:38:46+0000] Collecting psutil>=5.6.3
2023-07-12T08:39:16.6861369Z [08:38:46+0000] Using cached psutil-5.9.5-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (282 kB)
2023-07-12T08:39:16.6861782Z [08:38:46+0000] Collecting azure-core<2.0.0,>=1.12.0
2023-07-12T08:39:16.6862131Z [08:38:46+0000] Using cached azure_core-1.28.0-py3-none-any.whl (185 kB)
2023-07-12T08:39:16.6862463Z [08:38:47+0000] Collecting typing-extensions>=4.3.0
2023-07-12T08:39:16.6862833Z [08:38:47+0000] Using cached typing_extensions-4.7.1-py3-none-any.whl (33 kB)
2023-07-12T08:39:16.6863063Z [08:38:47+0000] Collecting six>=1.11.0
2023-07-12T08:39:16.6863401Z [08:38:47+0000] Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
2023-07-12T08:39:16.6863648Z [08:38:47+0000] Collecting msal<2.0.0,>=1.20.0
2023-07-12T08:39:16.6863984Z [08:38:47+0000] Using cached msal-1.22.0-py2.py3-none-any.whl (90 kB)
2023-07-12T08:39:16.6864452Z [08:38:47+0000] Collecting msal-extensions<2.0.0,>=0.3.0
2023-07-12T08:39:16.6864830Z [08:38:47+0000] Using cached msal_extensions-1.0.0-py2.py3-none-any.whl (19 kB)
2023-07-12T08:39:16.6865075Z [08:38:50+0000] Collecting cryptography>=2.5
2023-07-12T08:39:16.6865474Z [08:38:50+0000] Using cached cryptography-41.0.2-cp37-abi3-manylinux_2_28_x86_64.whl (4.3 MB)
2023-07-12T08:39:16.6865734Z [08:38:52+0000] Collecting cffi>=1.12
2023-07-12T08:39:16.6866154Z [08:38:52+0000] Using cached cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB)
2023-07-12T08:39:16.6866433Z [08:38:52+0000] Collecting pycparser
2023-07-12T08:39:16.6866781Z [08:38:52+0000] Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
2023-07-12T08:39:16.6867025Z [08:38:53+0000] Collecting PyJWT[crypto]<3,>=1.0.0
2023-07-12T08:39:16.6867371Z [08:38:53+0000] Using cached PyJWT-2.7.0-py3-none-any.whl (22 kB)
2023-07-12T08:39:16.6867624Z [08:38:53+0000] Collecting portalocker<3,>=1.0
2023-07-12T08:39:16.6867985Z [08:38:53+0000] Using cached portalocker-2.7.0-py2.py3-none-any.whl (15 kB)
2023-07-12T08:39:16.6868312Z [08:38:53+0000] Collecting opencensus-context>=0.1.3
2023-07-12T08:39:16.6868693Z [08:38:53+0000] Using cached opencensus_context-0.1.3-py2.py3-none-any.whl (5.1 kB)
2023-07-12T08:39:16.6869052Z [08:38:54+0000] Collecting google-api-core<3.0.0,>=1.0.0
2023-07-12T08:39:16.6869410Z [08:38:54+0000] Using cached google_api_core-2.11.1-py3-none-any.whl (120 kB)
2023-07-12T08:39:16.6869751Z [08:38:57+0000] Collecting protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0.dev0,>=3.19.5
2023-07-12T08:39:16.6870217Z [08:38:57+0000] Using cached protobuf-4.23.4-cp37-abi3-manylinux2014_x86_64.whl (304 kB)
2023-07-12T08:39:16.6870588Z [08:38:57+0000] Collecting googleapis-common-protos<2.0.dev0,>=1.56.2
2023-07-12T08:39:16.6870998Z [08:38:57+0000] Using cached googleapis_common_protos-1.59.1-py2.py3-none-any.whl (224 kB)
2023-07-12T08:39:16.6871442Z [08:38:58+0000] Collecting google-auth<3.0.dev0,>=2.14.1
2023-07-12T08:39:16.6871808Z [08:38:58+0000] Using cached google_auth-2.22.0-py2.py3-none-any.whl (181 kB)
2023-07-12T08:39:16.6872106Z [08:38:58+0000] Collecting rsa<5,>=3.1.4
2023-07-12T08:39:16.6872507Z [08:38:58+0000] Using cached rsa-4.9-py3-none-any.whl (34 kB)
2023-07-12T08:39:16.6872725Z [08:38:59+0000] Collecting urllib3<2.0
2023-07-12T08:39:16.6873129Z [08:38:59+0000] Using cached urllib3-1.26.16-py2.py3-none-any.whl (143 kB)
2023-07-12T08:39:16.6873437Z [08:38:59+0000] Collecting cachetools<6.0,>=2.0.0
2023-07-12T08:39:16.6873777Z [08:38:59+0000] Using cached cachetools-5.3.1-py3-none-any.whl (9.3 kB)
2023-07-12T08:39:16.6874153Z [08:38:59+0000] Collecting pyasn1-modules>=0.2.1
2023-07-12T08:39:16.6874574Z [08:38:59+0000] Using cached pyasn1_modules-0.3.0-py2.py3-none-any.whl (181 kB)
2023-07-12T08:39:16.6874937Z [08:39:00+0000] Collecting pyasn1<0.6.0,>=0.4.6
2023-07-12T08:39:16.6875406Z [08:39:00+0000] Using cached pyasn1-0.5.0-py2.py3-none-any.whl (83 kB)
2023-07-12T08:39:16.6875733Z [08:39:00+0000] Collecting certifi>=2017.4.17
2023-07-12T08:39:16.6876032Z [08:39:00+0000] Using cached certifi-2023.5.7-py3-none-any.whl (156 kB)
2023-07-12T08:39:16.6876373Z [08:39:01+0000] Collecting charset-normalizer<4,>=2
2023-07-12T08:39:16.6876818Z [08:39:01+0000] Using cached charset_normalizer-3.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (201 kB)
2023-07-12T08:39:16.6877063Z [08:39:01+0000] Collecting idna<4,>=2.5
2023-07-12T08:39:16.6877622Z [08:39:01+0000] Using cached idna-3.4-py3-none-any.whl (61 kB)
2023-07-12T08:39:16.6878528Z [08:39:03+0000] Installing collected packages: pycparser, cffi, urllib3, PyJWT, pyasn1, idna, cryptography, charset-normalizer, certifi, six, rsa, requests, pyasn1-modules, protobuf, cachetools, typing-extensions, portalocker, msal, googleapis-common-protos, google-auth, opencensus-context, msal-extensions, google-api-core, azure-core, psutil, opencensus, azure-identity, opencensus-ext-azure, azure-functions
2023-07-12T08:39:20.9948748Z [08:39:13+0000] Successfully installed PyJWT-2.7.0 azure-core-1.28.0 azure-functions-1.15.0 azure-identity-1.13.0 cachetools-5.3.1 certifi-2023.5.7 cffi-1.15.1 charset-normalizer-3.2.0 cryptography-41.0.2 google-api-core-2.11.1 google-auth-2.22.0 googleapis-common-protos-1.59.1 idna-3.4 msal-1.22.0 msal-extensions-1.0.0 opencensus-0.11.2 opencensus-context-0.1.3 opencensus-ext-azure-1.1.9 portalocker-2.7.0 protobuf-4.23.4 psutil-5.9.5 pyasn1-0.5.0 pyasn1-modules-0.3.0 pycparser-2.21 requests-2.31.0 rsa-4.9 six-1.16.0 typing-extensions-4.7.1 urllib3-1.26.16
2023-07-12T08:39:20.9950074Z WARNING: You are using pip version 21.2.4; however, version 23.1.2 is available.
2023-07-12T08:39:20.9950795Z You should consider upgrading via the '/tmp/oryx/platforms/python/3.10.4/bin/python3.10 -m pip install --upgrade pip' command.
2023-07-12T08:39:20.9998647Z Not a vso image, so not writing build commands
2023-07-12T08:39:20.9999565Z Preparing output...
2023-07-12T08:39:20.9999717Z
2023-07-12T08:39:21.0000263Z Copying files to destination directory '/tmp/build/expressbuild'...
2023-07-12T08:39:21.0000587Z Done in 3 sec(s).
2023-07-12T08:39:21.0000660Z
2023-07-12T08:39:21.0000891Z Removing existing manifest file
2023-07-12T08:39:21.0001073Z Creating a manifest file...
2023-07-12T08:39:21.0001302Z Manifest file created.
2023-07-12T08:39:21.0001543Z Copying .ostype to manifest output directory.
2023-07-12T08:39:21.0001641Z
2023-07-12T08:39:21.0001776Z Done in 36 sec(s).
2023-07-12T08:39:21.0002003Z Writing the artifacts to a Zip file
2023-07-12T08:39:24.3539530Z Running post deployment command(s)...
2023-07-12T08:39:24.3539695Z
2023-07-12T08:39:24.3539858Z Generating summary of Oryx build
2023-07-12T08:39:24.3540537Z Deployment Log file does not exist in /tmp/oryx-build.log
2023-07-12T08:39:24.3540947Z The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build
2023-07-12T08:39:24.3541211Z Triggering recycle (preview mode disabled).
2023-07-12T08:39:24.3541685Z Deployment successful. deployer = Push-Deployer deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
2023-07-12T08:39:27.3552458Z Remote build succeeded!
2023-07-12T08:39:28.4167140Z [command]/usr/bin/az account clear
2023-07-12T08:39:28.9696123Z ##[section]Finishing: Deploy Azure Function
This is from the default docker log:
2023-07-12T09:57:00.484247363Z Starting OpenBSD Secure Shell server: sshd.
2023-07-12T09:59:18.251969897Z Hosting environment: Production
2023-07-12T09:59:18.268409880Z Content root path: /azure-functions-host
2023-07-12T09:59:18.268892912Z Now listening on: http://[::]:80
2023-07-12T09:59:18.268907313Z Application started. Press Ctrl+C to shut down.
Here is the docker log:
2023-07-12T09:57:02.718Z INFO - Initiating warmup request to container chuckazfuncpocfad01_1_451959e8 for site chuckazfuncpocfad01
2023-07-12T09:57:34.405Z INFO - Waiting for response to warmup request for container chuckazfuncpocfad01_1_451959e8. Elapsed time = 31.6870666 sec
2023-07-12T09:57:51.337Z INFO - Waiting for response to warmup request for container chuckazfuncpocfad01_1_451959e8. Elapsed time = 48.6194851 sec
2023-07-12T09:58:14.319Z INFO - Waiting for response to warmup request for container chuckazfuncpocfad01_1_451959e8. Elapsed time = 71.6007311 sec
2023-07-12T09:58:31.684Z INFO - Waiting for response to warmup request for container chuckazfuncpocfad01_1_451959e8. Elapsed time = 88.9662995 sec
2023-07-12T09:58:48.246Z INFO - Waiting for response to warmup request for container chuckazfuncpocfad01_1_451959e8. Elapsed time = 105.5278684 sec
2023-07-12T09:59:05.691Z INFO - Waiting for response to warmup request for container chuckazfuncpocfad01_1_451959e8. Elapsed time = 122.9727993 sec
2023-07-12T09:59:19.051Z ERROR - Container chuckazfuncpocfad01_1_451959e8 for site chuckazfuncpocfad01 has exited, failing site start
2023-07-12T09:59:19.070Z ERROR - Container chuckazfuncpocfad01_1_451959e8 didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging.
2023-07-12T09:59:19.073Z INFO - Stopping site chuckazfuncpocfad01 because it failed during startup.
I wasn't able to retrieve any container logs.
please create Support request on azure portal for this.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
When I started to create a support request, I was directed to an error message: TypeError: Descriptors cannot not be created directly
that was being generated somewhere in the function app. This led me to the following stackoverflow article: https://stackoverflow.com/questions/72441758/typeerror-descriptors-cannot-not-be-created-directly. I added the configuration setting PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
, redeployed the function, and now I can trigger the function, even when opencensus-ext-azure is installed. So my issue is fixed.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
Investigative information
Please provide the following:
Repro steps
Provide the steps required to reproduce the problem:
Add "opencensus-ext-azure" to requirements.txt and publish the function. The function code is irrelevant and the module doesn't need to be called in the code, just by installing the module the function crashes.
I am trying to add instrumentation to an existing app I have deployed in an Azure Function in Azure China, the function is working fine but Azure China doesn't support codeless integration with Application Insights, after trying to instrument the function with opencensus extension for Azure monitor I noticed my function was constantly crashing so I trimmed down the code to understand what was causing it to crash, what I discovered is that just by adding the module "opencensus-ext-azure" to the requirements file and publishing the function app it crashes. My requirements.txt file looks like follows, and I didn't make any changes to the existing code (tested and working):
The other thing I tried is, with the working code deployed and function running, I SSH'ed into the function worker and manually created the requirements.txt file (same as above) and a func.py that is a copy of the working code but uses opencensus extension for Azure and AzureLogHandler and is run as a script directly from shell (no triggers and bindings):
Running
pip install -r requirements.txt
followed byphyton3.9 func.py
directly from shell within the function worker works perfectly fine, the issue only seems to be when deploying using Azure Core tools withfunc azure functionapp publish avx-controller-functionapp --build remote --python
The function was deployed using Terraform as follows
Expected behavior
Provide a description of the expected behavior.
Function shouldn't be crashing and it can be invoked
Actual behavior
Provide a description of the actual behavior observed.
After publishing the function using Azure Core Tools
func azure functionapp publish avx-controller-functionapp --build remote --python
the function is constantly crashing with "Azure Function Runtime is not available"Known workarounds
Provide a description of any known workarounds.
No workarounds
Contents of the requirements.txt file:
Provide the requirements.txt file to help us find out module related issues.
Related information
Provide any related information
-->