microsoft / Oryx

Build your repo automatically.
Other
748 stars 171 forks source link

Not all HTTPTrigger functons found after deploying Azure Function v4 #1965

Closed jurijsk closed 8 months ago

jurijsk commented 1 year ago

When deploying using func azure functionapp publish {func-name} --build remote

I get the success but few of the function are not listed at the end.

PS project-path> func azure functionapp publish func-name --build remote
Getting site publishing info...
Creating archive for current directory...
Performing remote build for functions project.
Uploading 33.31 KB [##############################################################################]
Remote build in progress, please wait...
Updating submodules.
Preparing deployment for commit id 'ded2125c-f'.
PreDeployment: context.CleanOutputPath False
PreDeployment: context.OutputPath /home/site/wwwroot
Repository path is /tmp/zipdeploy/extracted
Running oryx build...
Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version ~18
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20230210.1, Commit: a49c8f6b8abbe95b4356552c4c884dea7fd0d86e, ReleaseTagName: 20230210.1

Build Operation ID: d2ba5ba7b2c1a8d3
Repository Commit : ded2125c-f176-4e06-9902-f38e9cab4435
OS Type           : bullseye
Image Type        : githubactions

Detecting platforms...
Detected following platforms:
  nodejs: 18.15.0
Version '18.15.0' of platform 'nodejs' is not installed. Generating script to install it...

Source directory     : /tmp/zipdeploy/extracted
Destination directory: /home/site/wwwroot

[..]

Using Node version:
v18.15.0

Using Npm version:
9.5.0

Running 'npm install'...

added 208 packages, and audited 209 packages in 26s

[..]

Running 'npm run build'...

> func-name@1.0.0 build
> tsc

Preparing output...

Copying files to destination directory '/home/site/wwwroot'...
Done in 6 sec(s).

Removing existing manifest file
Creating a manifest file...
Manifest file created.
Copying .ostype to manifest output directory.

Done in 50 sec(s).
Running post deployment command(s)...

Generating summary of Oryx build
Deployment Log file does not exist in /tmp/oryx-build.log
The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build
Triggering recycle (preview mode disabled).
Linux Consumption plan has a 1.5 GB memory limit on a remote build container.
To check our service limit, please visit https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale#service-limits
Writing the artifacts to a squashfs file
Parallel mksquashfs: Using 1 processor
Creating 4.0 filesystem on /home/site/artifacts/functionappartifact.squashfs, block size 131072.

[..]

Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
        compressed data, compressed metadata, compressed fragments,
        compressed xattrs, compressed ids
        duplicates are removed
Filesystem size 187375.01 Kbytes (182.98 Mbytes)
        32.01% of uncompressed filesystem size (585335.59 Kbytes)
Inode table size 73173 bytes (71.46 Kbytes)
        29.50% of uncompressed inode table size (248027 bytes)
Directory table size 64602 bytes (63.09 Kbytes)
        40.19% of uncompressed directory table size (160737 bytes)
Number of duplicate files found 1729
Number of inodes 7175
Number of files 6479
Number of fragments 148
Number of symbolic links  17
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 679
Number of ids (unique uids + gids) 1
Number of uids 1
        root (0)
Number of gids 1
        root (0)
Creating placeholder blob for linux consumption function app...
SCM_RUN_FROM_PACKAGE placeholder blob scm-latest-func-name.zip located
Uploading built content /home/site/artifacts/functionappartifact.squashfs for linux consumption function app...
Resetting all workers for func-name.azurewebsites.net
Deployment successful. deployer = Push-Deployer deploymentPath = Functions App ZipDeploy. Extract zip. Remote build.
Remote build succeeded!
Syncing triggers...
Functions in func-name:
    goto - [httpTrigger]
        Invoke url: https://func-name.azurewebsites.net/goto

    hello - [httpTrigger]
        Invoke url: https://func-name.azurewebsites.net/hello

I would love to have some output on why some of the functions are not loaded. And more informative log in general.

The method I use to troubleshot is to gradually reduce the complexity of failed to load function and try to locate the problem.

I'm my case the problem was in one of the libraries I use. I guess the issue occurs during the discovery and initialization of functions, so this likely out of scope of this project.

Nevertheless, I would like to know if it is possible to get better logs our of the build. Therefore few regarding Oryx:

  1. Is it possible to access actual build scripts and configuration used?
  2. One of the lines in the log: PreDeployment: context.CleanOutputPath False how to change this to true?
  3. Other part says:
    Deployment Log file does not exist in /tmp/oryx-build.log
    The logfile at /tmp/oryx-build.log is empty. Unable to fetch the summary of build

    Is it possible to reconfigure this to get the build summary?

harryli0108 commented 1 year ago

Hi @jurijsk! Thank you for sharing your feedback on your debugging process.

  1. In order to get access to build scripts and configurations used, you can try and use Oryx CLI. Run oryx build-script <SourceDir> to generate build script to your current working directory.
  2. For toggling CleanOutputPath to true, it looks like a configuration done from the Azure Function settings. But as from Oryx side, I'm not sure how exactly to configure this.
  3. The log generated by oryx is usually saved as oryx.log. Looks like we don't generate file with the name oryx-build.log. I'll share this with the team to double check this issue.

Meanwhile, please let me know if there's any other things I could help with!

jurijsk commented 1 year ago

Thank you for your reply @harryli0108!

Regarding Oryx CLI, is that something I can do within Azure Function App environment, or I can install Oryx on Windows machine?

harryli0108 commented 1 year ago

I'm not sure if you could access with the Function App env. The CLI tool comes preinstalled with Oryx docker image. you can try pull and spin up a docker container with the oryx build image and use Oryx CLI tool within the container.

E.g., docker pull mcr.microsoft.com/oryx/build:latest

This would give you what the actual build script would look like.

simonjj commented 8 months ago

This issue seems resolved. Will be closing this issue. If this is still relevant and impacting you please open a new issue and link back to this issue for reference.