Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Unable to deploy azure nodejs functions with nested directory structure using Azure pipeline #402

@anilsakr

Description

@anilsakr

Hello,

I am trying to deploy Azure Functions with a nested directory structure using Azure Pipeline, but it's not working. When I place the function directories in the root directory, it works fine, but when I place the function in a nested directory, it's not working. I have followed the instructions in the documentation mentioned below, but it's not working:

https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-azure-devops?tabs=nodejs%2Cyaml%2Cjavascript

Here's an example of the directory structure I'm using:
├── host.json
├── nested
│ ├── foo
│ │ ├── function.json
│ │ └── index.js
│ ├── bar
│ │ ├── function.json
│ │ └── index.js
│ └── baz
│ ├── function.json
│ └── index.js
├── package.json
└── README.md

Here's my azurepipeline.yaml file:

`pool:
name: Azure Pipelines
steps:

  • task: NodeTool@0
    displayName: 'Use Node version'
    inputs:
    versionSpec: 18.x

  • task: Npm@1
    displayName: 'Install Application Dependencies'
    inputs:
    workingDir: '$(System.DefaultWorkingDirectory)'
    verbose: false

  • task: Npm@1
    displayName: 'Run ''build'' script'
    inputs:
    command: custom
    workingDir: '$(System.DefaultWorkingDirectory)'
    verbose: false
    customCommand: 'run build --if-present'

  • task: Npm@1
    displayName: 'Remove extraneous packages'
    inputs:
    command: custom
    workingDir: '$(System.DefaultWorkingDirectory)'
    verbose: false
    customCommand: 'prune --production'

  • task: ArchiveFiles@2
    inputs:
    rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
    includeRootFolder: false
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    replaceExistingArchive: true
    displayName: 'Archive files'

  • task: PublishBuildArtifacts@1
    inputs:
    artifactName: 'drop'
    pathtoPublish: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    displayName: 'Publish build artifacts'

  • task: DownloadBuildArtifacts@0
    inputs:
    buildType: 'current'
    downloadType: 'single'
    artifactName: 'drop'
    downloadPath: '$(System.DefaultWorkingDirectory)'
    displayName: 'Download build artifacts'

  • task: AzureFunctionApp@1
    inputs:
    azureSubscription: Pay-As-You-Go
    appType: functionApp
    appName: kljdsaglkds
    package: $(System.DefaultWorkingDirectory)/drop/$(Build.BuildId).zip
    displayName: 'Deploy to Azure Function App'`

Could you please help me with an example of how to deploy Azure Functions with a nested directory structure using Azure Pipeline? Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions