microsoft / Oryx

Build your repo automatically.
Other
768 stars 176 forks source link

No HTTP triggers found #1774

Open JackH11 opened 1 year ago

JackH11 commented 1 year ago

Bug Report

The function and trigger work when testing locally through azurite. Once I got to deploying the function from vscode, I received the output: "No HTTP triggers found". The function and trigger work when testing locally through azurite.

After the upload has been attempted, I can however see the project files that I uploaded under the "files" dropdown when viewing azure subscription through vscode.

11:41:54 PM testing124234: Starting deployment...
11:41:56 PM testing124234: Creating zip package...
11:41:56 PM testing124234: Zip package size: 3.75 kB
11:41:54 PM testing124234: Fetching changes.
11:41:55 PM testing124234: Cleaning up temp folders from previous zip deployments and extracting pushed zip file /tmp/zipdeploy/1aef5e85-af84-406a-9215-dff0086cc290.zip (0.00 MB) to /tmp/zipdeploy/extracted
11:41:57 PM testing124234: Updating submodules.
11:41:58 PM testing124234: Preparing deployment for commit id '68704b96-4'.
11:41:58 PM testing124234: PreDeployment: context.CleanOutputPath False
11:41:58 PM testing124234: PreDeployment: context.OutputPath /home/site/wwwroot
11:41:58 PM testing124234: Repository path is /tmp/zipdeploy/extracted
11:41:58 PM testing124234: Running oryx build...
11:41:58 PM testing124234: Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.9.7 -p packagedir=.python_packages/lib/site-packages
11:41:59 PM testing124234: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
11:41:59 PM testing124234: You can report issues at https://github.com/Microsoft/Oryx/issues
11:41:59 PM testing124234: Oryx Version: 0.2.20210120.1, Commit: 66c7820d7df527aaffabd2563a49ad57930999c9, ReleaseTagName: 20210120.1
11:41:59 PM testing124234: Build Operation ID: |2JLrmJIE0Vo=.db19ac63_
11:41:59 PM testing124234: Repository Commit : 68704b96-4c46-4c30-bf62-29de88faeecb
11:41:59 PM testing124234: Detecting platforms...
11:42:00 PM testing124234: Detected following platforms:
11:42:00 PM testing124234:   python: 3.9.7
11:42:00 PM testing124234: Version '3.9.7' of platform 'python' is not installed. Generating script to install it...
11:42:00 PM testing124234: Source directory     : /tmp/zipdeploy/extracted
11:42:00 PM testing124234: Destination directory: /home/site/wwwroot
11:42:00 PM testing124234: Downloading and extracting 'python' version '3.9.7' to '/tmp/oryx/platforms/python/3.9.7'...
11:42:01 PM testing124234: Downloaded in 1 sec(s).
11:42:01 PM testing124234: Verifying checksum...
11:42:02 PM testing124234: Extracting contents...
11:42:04 PM testing124234: Done in 4 sec(s).
11:42:04 PM testing124234: Python Version: /tmp/oryx/platforms/python/3.9.7/bin/python3.9
11:42:04 PM testing124234: Running pip install...
11:42:05 PM testing124234: [04:42:05+0000] Collecting azure-functions
11:42:05 PM testing124234: [04:42:05+0000]   Downloading azure_functions-1.12.0-py3-none-any.whl (160 kB)
11:42:05 PM testing124234: [04:42:05+0000] Installing collected packages: azure-functions
11:42:05 PM testing124234: [04:42:05+0000] Successfully installed azure-functions-1.12.0
11:42:05 PM testing124234: WARNING: You are using pip version 20.2.3; however, version 22.3.1 is available.
11:42:05 PM testing124234: You should consider upgrading via the '/tmp/oryx/platforms/python/3.9.7/bin/python3.9 -m pip install --upgrade pip' command.
11:42:05 PM testing124234: Done in 1 sec(s).
11:42:05 PM testing124234: Preparing output...
11:42:05 PM testing124234: Copying files to destination directory '/home/site/wwwroot'...
11:42:05 PM testing124234: Done in 0 sec(s).
11:42:05 PM testing124234: Removing existing manifest file
11:42:05 PM testing124234: Creating a manifest file...
11:42:05 PM testing124234: Manifest file created.
11:42:05 PM testing124234: Done in 5 sec(s).
11:42:07 PM testing124234: Running post deployment command(s)...
11:42:07 PM testing124234: Generating summary of Oryx build
11:42:07 PM testing124234: Deployment Log file does not exist in /tmp/oryx-build.log
11:42:07 PM testing124234: The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build
11:42:07 PM testing124234: Triggering recycle (preview mode disabled).
11:42:07 PM testing124234: Linux Consumption plan has a 1.5 GB memory limit on a remote build container.
11:42:07 PM testing124234: To check our service limit, please visit https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale#service-limits
11:42:07 PM testing124234: Writing the artifacts to a squashfs file
11:42:07 PM testing124234: Parallel mksquashfs: Using 1 processor
11:42:07 PM testing124234: Creating 4.0 filesystem on /home/site/artifacts/functionappartifact.squashfs, block size 131072.
11:42:07 PM testing124234: [===============================================================|] 132/132 100%
11:42:07 PM testing124234: Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
11:42:07 PM testing124234:  compressed data, compressed metadata, compressed fragments, compressed xattrs
11:42:07 PM testing124234:  duplicates are removed
11:42:07 PM testing124234: Filesystem size 315.78 Kbytes (0.31 Mbytes)
11:42:07 PM testing124234:  27.20% of uncompressed filesystem size (1160.89 Kbytes)
11:42:07 PM testing124234: Inode table size 1401 bytes (1.37 Kbytes)
11:42:07 PM testing124234:  28.79% of uncompressed inode table size (4866 bytes)
11:42:07 PM testing124234: Directory table size 1467 bytes (1.43 Kbytes)
11:42:07 PM testing124234:  37.07% of uncompressed directory table size (3957 bytes)
11:42:07 PM testing124234: Number of duplicate files found 3
11:42:07 PM testing124234: Number of inodes 152
11:42:07 PM testing124234: Number of files 135
11:42:07 PM testing124234: Number of fragments 11
11:42:07 PM testing124234: Number of symbolic links  0
11:42:07 PM testing124234: Number of device nodes 0
11:42:07 PM testing124234: Number of fifo nodes 0
11:42:07 PM testing124234: Number of socket nodes 0
11:42:07 PM testing124234: Number of directories 17
11:42:07 PM testing124234: Number of ids (unique uids + gids) 1
11:42:07 PM testing124234: Number of uids 1
11:42:07 PM testing124234:  root (0)
11:42:07 PM testing124234: Number of gids 1
11:42:07 PM testing124234:  root (0)
11:42:07 PM testing124234: Creating placeholder blob for linux consumption function app...
11:42:07 PM testing124234: SCM_RUN_FROM_PACKAGE placeholder blob scm-latest-testing124234.zip located
11:42:07 PM testing124234: Uploading built content /home/site/artifacts/functionappartifact.squashfs for linux consumption function app...
11:42:08 PM testing124234: Resetting all workers for testing124234.azurewebsites.net
11:42:08 PM testing124234: Deployment successful. deployer = ms-azuretools-vscode deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
11:42:36 PM testing124234: Syncing triggers...
11:42:39 PM testing124234: Querying triggers...
11:42:40 PM testing124234: No HTTP triggers found.
DataGoblin commented 11 months ago

For me this was caused by two things, relative imports being funky and initializing classes outside of Azure functions. Code base was Python.

The lack of error logs was frustrating. 😭😭

gagiD commented 11 months ago

For me fix was to set Node version to 20 (was 18). Error message are really useless.

foxtrotdotrocks commented 10 months ago

I was struggling with this for a few hours. Turns out that I needed to configure the Azure Function to be 64-bit instead of the default 32-bit.

I had to revert to NodeJs V3, which gave me the exception that I needed.

simonjj commented 10 months ago

Keeping this issue open to help others landing here. Even though we're covering a wide array of related issues in one.

scgtam commented 10 months ago

After trying all above recommondations I still did not succeded to get de Functions visible. The deployment went well, only no function triggers could be found. Running V4, Python 3.10, deploying with ZIP deployment from Azure DevOps

But I got it working again! I did 2 things, but not sure which one did the trick...

I added a Try Except statements around my import packages. Like so: image

When importing packages the function won't crash on error and will show the function triggers. But when running the Azure Function it will show a runtime error, hopefully with a message thats meaningfull.

Secondly I added fixed versions to my requirements.txt. Like so: image

I noted that package azure-storage-file-datalake was just updated to a new version. (the next day there was already a .1 version which suggest there was a issue within the package) Locally everything workt. Even after removing all installations with PIP and reinstall the latest version. But I am developing on Windows and the Functions online runs with Linux.. so maybee that may have an influence.

Sadly I couldn't reproduce the issue so I am not 100% sure what got the function working again.

This solved it. But I believed the solution is because of the pkg version. I updated the requirement.txt file of mine to the same version of my running on my local machine. I didn't put the try and except and it magically working. So it looks like some of the updated pkg is preventing the importing process.

Hornet47 commented 8 months ago

After trying all above recommondations I still did not succeded to get de Functions visible. The deployment went well, only no function triggers could be found. Running V4, Python 3.10, deploying with ZIP deployment from Azure DevOps But I got it working again! I did 2 things, but not sure which one did the trick... I added a Try Except statements around my import packages. Like so: image When importing packages the function won't crash on error and will show the function triggers. But when running the Azure Function it will show a runtime error, hopefully with a message thats meaningfull. Secondly I added fixed versions to my requirements.txt. Like so: image I noted that package azure-storage-file-datalake was just updated to a new version. (the next day there was already a .1 version which suggest there was a issue within the package) Locally everything workt. Even after removing all installations with PIP and reinstall the latest version. But I am developing on Windows and the Functions online runs with Linux.. so maybee that may have an influence. Sadly I couldn't reproduce the issue so I am not 100% sure what got the function working again.

This solved it. But I believed the solution is because of the pkg version. I updated the requirement.txt file of mine to the same version of my running on my local machine. I didn't put the try and except and it magically working. So it looks like some of the updated pkg is preventing the importing process.

Thank you so much! I also encountered the same problem because I didn't include a package in requirements.txt.

Pareek210 commented 8 months ago

Solved my issue. psycopg2 does not work. Use psycopg2-binary instead. After uninstalling psycopg2, installing psycopg2-binary, and updating requirements.txt, the app was able to publish. Had to roll back to the Azure Functions Python V1, publish, and then review error messages to sort this out.

Would be good if psycopg2 could work since "the binary package is a practical choice for development and testing but in production it is advised to use the package built from sources" according to https://pypi.org/project/psycopg2-binary/.

From the V1 error message:

Exception while executing function: Functions.HttpExample Result: Failure
Exception: ImportError: libpq.so.5: cannot open shared object file: No such file or directory. Please check the requirements.txt file for the missing module. For more info, please refer the troubleshooting guide: https://aka.ms/functions-modulenotfound
Stack:   File "/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/dispatcher.py", line 380, in _handle__function_load_request
    func = loader.load_function(
  File "/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 48, in call
    raise extend_exception_message(e, message)
  File "/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 44, in call
    return func(*args, **kwargs)
  File "/azure-functions-host/workers/python/3.10/LINUX/X64/azure_functions_worker/loader.py", line 132, in load_function
    mod = importlib.import_module(fullmodname)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/site/wwwroot/HttpExample/__init__.py", line 5, in <module>
    import psycopg2
  File "/home/site/wwwroot/.python_packages/lib/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa

Thanks a lot. You are a life saver. Its unfortunate that psycopg2 still doesn't work.

ncmindera commented 8 months ago

Same issue here. For me the solution was to add to azure function all the app settings and then deploy. I thought I could deploy and then add the settings but it didn't workout this way. It should be somewhere in the documentation

levalencia commented 7 months ago

Referenc

THIS IS SUPER SMART

WIth this trick the functions were loaded, then I was able to see them, but I wasnt able to execute them because the api key page was not loading (internal server error).

So I changed my functions to ANONYMOUS and tried again, and indeed I was missing a setting in key vault which is loaded in the imports!

Microsoft! please fix t his with logging at least! this is very difficult to debug.

karoldziubak commented 5 months ago

I've tried switching to Pyton 3.10, using try/except on imports, checked app settings, changed to ANONYMOUS and it still locally it works perfect, but cant deploy. Very frustrating

AllaeddineD commented 3 months ago

Dropping down to Python 3.10 (from 3.11) fixed the "No HTTP triggers found" for me VS Code 1.83.0

I confirm, downgrading python version from 3.11 worked for me as well.

PS: Downgraded to py3.9

empowerNate commented 3 months ago

This was working fine until today, now deployments that worked before magically don't work. Not sure what changed since most package versions are pinned. Py311, maybe downgrading could help, but that would be a lame workaround.

empowerNate commented 3 months ago

After hours of changing settings, restarting, checking logs, still can't get it to work. Not a missing package issue, seems to start up just fine. Initialized the warmup function and loaded sklearn, no missing package errors. Still no HTTP triggers found. Can't figure it out.