[BUG] 2.45.1 CE: Webhooks silently ignore inactive stacks since 2.44.0 (HTTP 204, no log)
Before you start please confirm the following.
- Yes, I've searched similar issues on GitHub.
- Yes, I've checked whether this issue is covered in the Portainer documentation.
Problem Description
In Portainer CE 2.45.1, stack webhooks are silently ignored when the associated stack is in the Inactive state.
The webhook endpoint still returns:
HTTP 204but:
- the stack remains Inactive;
- no deployment/redeployment is performed;
- no containers are started;
- no message explaining that the webhook was ignored is written to the Portainer logs, even with
--log-level=DEBUG.
After investigating the source, this appears to be caused by the following check in RedeployWhenChanged():
stack, err := datastore.Stack().Read(stackID)
if err != nil {
return err
}
if stack.Status == portainer.StackStatusInactive {
return nil
}Because this returns nil, the webhook handler considers the request successfully handled and returns HTTP 204.
The return also occurs before the existing debug log:
log.Debug().
Int("stack_id", int(stack.ID)).
Msg("redeploying stack")which explains why there is no diagnostic output when an Inactive stack is ignored.
From source comparison, the StackStatusInactive early return appears to have been introduced as part of commit:
0e9d7e3b5ebf3913c1ed1931b05facf7893dc948
feat(gitops): rework the flow so the sources are the triggerand is present starting with the 2.44.0 code line. It remains present in 2.45.1.
The purpose of this issue is therefore primarily to confirm:
Is it intentional that a stack webhook must not activate/redeploy an Inactive stack?
If this behavior is intentional, I believe the current handling is still problematic because the request is silently accepted with HTTP 204 and there is no indication to the caller or administrator (in the logs) that the stack was deliberately ignored.
It would also be useful to consider making this behavior configurable, as there are GitOps workflows where the webhook is intentionally used to activate/redeploy a currently inactive stack. The default can be the new behaviors. This would provide backward compatibility.
Expected Behavior
There are two possible expected behaviors depending on whether ignoring Inactive stacks is intentional.
If Inactive stacks are intended to be deployable by webhook
Calling a valid stack webhook should process the GitOps update and activate/redeploy the associated stack, including when its current Portainer status is Inactive.
This was previously possible: an Inactive stack could receive a webhook, be deployed, and transition to Active.
If ignoring Inactive stacks is intentional
Portainer should make this behavior observable.
At minimum, I would expect a log message such as:
Ignoring stack webhook because stack <id/name> is inactivePreferably, the HTTP response should also distinguish between:
- webhook accepted and deployment initiated; and
- webhook valid but deliberately ignored because the stack is Inactive.
It would additionally be useful to have an option controlling whether GitOps webhooks are allowed to activate/redeploy Inactive stacks.
For example:
Allow webhook to deploy inactive stack: Yes / NoThe current behavior — returning HTTP 204 with no deployment and no log message — makes it very difficult to distinguish an intentionally ignored webhook from a malfunctioning webhook.
Actual Behavior
Given an existing Git-backed stack with a valid webhook:
Stack status: Inactivecalling the webhook returns:
HTTP 204but:
Stack status: Inactive
Container(s): not started
Deployment: not performedNo corresponding Portainer log entry is generated.
This remains the case with Portainer configured with:
command:
- --log-level=DEBUGThere is no indication in the log that:
- the webhook was received;
- the stack was found;
- the stack was Inactive; or
- the webhook was intentionally ignored.
Steps to Reproduce
Run Portainer CE 2.45.1.
Create a Git-backed Docker Compose stack and enable its stack webhook.
Stop the stack through Portainer so that its status becomes:
InactiveAdd a new commit to the associated Git repository.
Trigger the stack webhook, for example:
curl -ksS -X POST \ -w '\nhttp_code=%{http_code}\n' \ 'https://<portainer>/api/stacks/webhooks/<uuid>'The request returns:
http_code=204Check the stack and its containers.
The stack remains:
Inactiveand its containers are not started.
Enable Portainer debug logging:
command: - --log-level=DEBUGrecreate the Portainer container and repeat the test.
The webhook again returns HTTP 204 and the stack remains Inactive, but there is still no debug/info/warning/error log indicating that the webhook was ignored.
The same behavior can also be reproduced when the webhook is triggered automatically by Forgejo after a pull request is merged into the Git branch used by the stack.
Portainer logs or screenshots
There is no corresponding Portainer log entry for the ignored webhook, including with:
--log-level=DEBUGThis appears to be explained by the current execution order in RedeployWhenChanged():
if stack.Status == portainer.StackStatusInactive {
return nil
}which occurs before:
log.Debug().
Int("stack_id", int(stack.ID)).
Msg("redeploying stack")As a result, an Inactive stack exits the webhook/GitOps processing path silently.
Portainer version
2.45.1
Portainer Edition
Community Edition (CE)
Platform and Version
Docker 29.4.3
OS and Architecture
Debian, x86_64
Browser
Brave
What command did you use to deploy Portainer?
Docker Compose:
services:
portainer:
image: docker.io/portainer/portainer-ce:2.45.1
container_name: "${CONTAINER_NAME:-portainer}"
restart: unless-stopped
user: "1000:10"
group_add:
- 121 # docker group to access docker.sock
command:
- --log-level=DEBUG
ports:
- "${AGENT_PORT:-8000}:8000"
- "${HTTP_PORT:-9000}:9000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- "${STACK_DIR:-/volume2/docker/portainer}/data:/data"
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
networks:
lan_mgmt:
aliases:
- "${PORTAINER_NETWORK_ALIAS:-portainer-network}"
networks:
lan_mgmt:
external: trueAdditional Information
Source comparison suggests that the behavior was introduced in the 2.44.0 development line by:
0e9d7e3b5ebf3913c1ed1931b05facf7893dc948
feat(gitops): rework the flow so the sources are the triggerThe relevant change added:
if stack.Status == portainer.StackStatusInactive {
return nil
}to RedeployWhenChanged().
This check is not present in the 2.43.0 implementation and is present in 2.44.0 and 2.45.1.
I am not requesting a fix for an older Portainer release. The issue is specifically against the current 2.45.1 behavior.
The questions for the maintainers are:
- Is ignoring stack webhooks for Inactive stacks intentional?
- If intentional, could Portainer log that the webhook was ignored and why?
- Could the HTTP response distinguish an ignored webhook from a webhook that actually initiated processing?
- Would it be possible to make this behavior configurable so that users can choose whether a webhook is allowed to activate/redeploy an Inactive stack?
The silent HTTP 204 behavior is particularly problematic for automated GitOps integrations because the webhook sender sees a successful response even though Portainer intentionally performs no action.
Source: portainer/portainer