MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.3k stars 21.48k forks source link

Error using cosmosDbTrigger in Azure Serverless Function #88265

Closed charlejc closed 1 year ago

charlejc commented 2 years ago

RE: #87183 Reopening.

See #87183 for build output.

Below is my build git hub workflow:

name: Azure Static Web Apps CI/CD

on: push: branches:

env: AZURE_FUNCTIONAPP_PACKAGE_PATH: './api' # set this to the path to your web app project, defaults to the repository root NODE_VERSION: '16.x' # set this to the node version to use (supports 8.x, 10.x, 12.x)

jobs: build_and_deploy_job: if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') runs-on: ubuntu-latest name: Build and Deploy Job steps:


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

ChaitanyaNaykodi-MSFT commented 2 years ago

Hello @charlejc Thank you for your feedback! We will review and update as appropriate.

MughundhanRaveendran-MSFT commented 2 years ago

@charlejc , I would like to isolate this issue to troubleshoot further. could you please try to publish the function package via CLI and check the outcome? Based on this result we can proceed further

charlejc commented 2 years ago

I'm not entirely sure how to publish the function package via the command line interface. But I will post the outcome once I figure this out.

Did you see the comment I left on the closed issue referenced above?

I think the problem is with Oryx. Here's the build log:

Run Azure/static-web-apps-deploy@v1 with: azure_static_web_apps_api_token: repo_token: action: upload app_location: / api_location: /api output_location: /build env: AZURE_FUNCTIONAPP_PACKAGE_PATH: ./api NODE_VERSION: 16.x /usr/bin/docker run --name db2d7d37f952bd38e40319f17545a4a55cddd_57cef3 --label 7db2d7 --workdir /github/workspace --rm -e AZURE_FUNCTIONAPP_PACKAGE_PATH -e NODE_VERSION -e INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN -e INPUT_REPO_TOKEN -e INPUT_ACTION -e INPUT_APP_LOCATION -e INPUT_API_LOCATION -e INPUT_OUTPUT_LOCATION -e INPUT_API_BUILD_COMMAND -e INPUT_APP_ARTIFACT_LOCATION -e INPUT_APP_BUILD_COMMAND -e INPUT_ROUTES_LOCATION -e INPUT_SKIP_APP_BUILD -e INPUT_CONFIG_FILE_LOCATION -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/as-good-as-it-gets/as-good-as-it-gets":"/github/workspace" 7db2d7:d37f952bd38e40319f17545a4a55cddd DeploymentId: 6ce55780-4f65-4bc8-8612-eb07f95145d3

App Directory Location: '/' was found. Api Directory Location: '/api' was found. Looking for event info Starting to build app with Oryx Azure Static Web Apps utilizes Oryx to build both static applications and Azure Functions. You can find more details on Oryx here: https://github.com/microsoft/Oryx ---Oryx build logs---

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.20211001.1, Commit: f0cbc9b1f0d056493cdb36f92b62f11921c87261, ReleaseTagName: 20211001.1

Build Operation ID: |aQgGKcBQQKU=.d71713e_ Repository Commit : 2bbde797f68d614db3e9446a7f3b1535fe3bfc84

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

Source directory : /github/workspace Destination directory: /bin/staticsites/ss-oryx/app

Downloading and extracting 'nodejs' version '16.13.2' to '/opt/nodejs/16.13.2'... Downloaded in 1 sec(s). Verifying checksum... Extracting contents... performing sha512 checksum for: nodejs... Done in 2 sec(s).

Removing existing manifest file Creating directory for command manifest file if it doesnot exist Creating a manifest file... Node Build Command Manifest file created.

Using Node version: v16.13.2

Using Npm version: 8.1.2

Running 'npm install --unsafe-perm'...

npm WARN old lockfile npm WARN old lockfile The package-lock.json file was created with an old version of npm, npm WARN old lockfile so supplemental metadata must be fetched from the registry. npm WARN old lockfile npm WARN old lockfile This is a one-time fix-up, please be patient... npm WARN old lockfile npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.

added 1468 packages, and audited 1469 packages in 2m

176 packages are looking for funding run npm fund for details

9 vulnerabilities (1 low, 8 moderate)

To address issues that do not require attention, run: npm audit fix

To address all issues (including breaking changes), run: npm audit fix --force

Run npm audit for details.

Running 'npm run build'...

as-good-as-it-gets@0.1.0 build react-scripts build

Creating an optimized production build... Compiled successfully.

File sizes after gzip:

235.36 kB build/static/js/main.ec7a6c10.js 1.79 kB build/static/js/787.f2021127.chunk.js

The project was built assuming it is hosted at /. You can control this with the homepage field in your package.json.

The build folder is ready to be deployed. You may serve it with a static server:

npm install -g serve serve -s build

Find out more about deployment here:

https://cra.link/deployment

Preparing output...

Copying files to destination directory '/bin/staticsites/ss-oryx/app'... Done in 4 sec(s).

Removing existing manifest file Creating a manifest file... Manifest file created.

Done in 140 sec(s).

---End of Oryx build logs--- Finished building app with Oryx Starting to build function app with Oryx ---Oryx build logs---

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.20211001.1, Commit: f0cbc9b1f0d056493cdb36f92b62f11921c87261, ReleaseTagName: 20211001.1

Build Operation ID: |rQhogeqKdS4=.33a7d2e2_ Repository Commit : 2bbde797f68d614db3e9446a7f3b1535fe3bfc84

Detecting platforms... Could not detect any platform in the source directory. Error: Could not detect the language from repo.

---End of Oryx build logs--- Oryx was unable to determine the build steps. Continuing assuming the assets in this folder are already built. If this is an unexpected behavior please contact support. [WARNING] The function language could not be detected. The language will be defaulted to node. Function Runtime Information. OS: linux, Functions Runtime: ~3, node version: 12 Finished building function app with Oryx Error in processing api build artifacts: the file 'RoomDocumentUpdated/function.json' has specified an invalid trigger of type 'cosmosDBTrigger' and direction 'in'. Currently, only httpTriggers are supported. Visit https://github.com/Azure/azure-functions-host/wiki/function.json for more information.

For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/ If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/ Exiting

MughundhanRaveendran-MSFT commented 1 year ago

MicrosoftDocs Github issue is mainly related to the document issue. In case if you have already validation the limitation then I would recommend you to create a thread on the forums - Microsoft Q&A or Stack Overflow Once you post your issue on forums, it will have visibility across the community which is a better suited audience for such types of issues.

I will go ahead and close this issue as this is troubleshooting issue. In case if you have any queries feel free to tag me in.