Skip to content

[Issue] Prepackage hook fails with error "hook script path ... escapes project root" since version 1.23.15 #7666

@ronaldbosma

Description

@ronaldbosma
  • Make sure you've installed the latest version using instructions

Output from azd version
azd version 1.23.15 (commit cfdc182) (stable)

Describe the bug
I have a prepackage hook on a service that fails to execute with version 1.23.15 of azd. See this failed workflow: https://github.com/ronaldbosma/track-availability-in-app-insights/actions/runs/24284688051/job/70912023507

Here's the error when running azd package:
ERROR: failed packaging service 'logicApp': failed invoking event handlers for 'prepackage', failed running scripts for hooks 'package', hook configuration for 'prepackage' is invalid, hook script path "../../hooks/prepackage-logicapp-build-functions-project.ps1" escapes project root "/home/runner/work/track-availability-in-app-insights/track-availability-in-app-insights/src/logicApp" Error: Process completed with exit code 1.

When I pin the azd version to 1.23.14 in the Azure/setup-azd@v2 task, the hook succeeds. See https://github.com/ronaldbosma/track-availability-in-app-insights/actions/runs/24284969050/job/70912716727

To Reproduce
This is my folder structure:

├── hooks              [ AZD hooks ]
├── infra              [ Infrastructure As Code files ]
└── src                [ Application code ]
    ├── functionApp    [ Azure Functions ]
    └── logicApp       [ Logic App workflows ]

I've created a prepackage hook for the logicApp service, but it's placed in the hooks folder at the root of my repo. Looking at the error, that seems to be causing the issue.

Expected behavior
I would expect version 1.23.15 to behave the same as 1.23.14 and execute the hook.

Environment
Information on your environment:
* Bicep CLI version 0.42.1 (caea9302e8)
* GitHub Actions Workflow

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions