Skip to content
This repository has been 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

Open
anilsakr opened this issue May 3, 2023 · 0 comments

Comments

@anilsakr
Copy link

anilsakr commented May 3, 2023

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.

@anilsakr anilsakr changed the title Unable to deploy azure functions with nested directory structure using Azure pipeline Unable to deploy azure nodejs functions with nested directory structure using Azure pipeline May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant