portainer: [2.19.0] Private git repository stack update webhook failing

Before you start please confirm the following.

Problem Description

After successfully creating a stack from a private git repo, trying to pull and redeploy the stack using the GitOps webhook URL results in an authentication error despite the git credentials previously working to create the stack.

Expected Behavior

I send a POST request to the stack’s Webhook URL and the Portainer pulls and redeploys the stack.

Actual Behavior

Sending a POST request to the webhook URL returns the below authentication error.

Steps to Reproduce

  1. Create a stack using a private git repository
  2. Enter git credentials or select saved git credentials
  3. Enable GitOps updates with the Webhook option and Re-pull image enabled
  4. curl the Webhook URL for the newly created stack

Portainer logs or screenshots

{“message”:“Failed to update the stack”,“details”:“failed to fetch latest commit id of stack:154: authentication failed, please ensure that the git credentials are correct”}

Portainer version

2.19.0

Portainer Edition

Business Edition (BE/EE) with Home & Student license

Platform and Version

Docker version 20.10.24+dfsg1, build 297e128

OS and Architecture

Debian 12

Browser

Firefox 117.0

What command did you use to deploy Portainer?

version: '3'
services:
    portainer:
        image: portainer/portainer-ee
        container_name: portainer
        restart: unless-stopped
        volumes:
            - '/var/run/docker.sock:/var/run/docker.sock'
            - 'portainer_data:/data'
        ports:
            - '9000:9000'
volumes:
    portainer_data:

Additional Information

Portainer is version 2.19.0

About this issue

  • Original URL
  • State: open
  • Created 10 months ago
  • Reactions: 7
  • Comments: 45 (9 by maintainers)

Most upvoted comments

Same thing here. Pulling the stack works ok on the web UI, triple checked that the git credentials were correct, and were working.

Also getting: failed to fetch latest commit id of stack:6: authentication failed, please ensure that the git credentials are correct

Note: I’m using a stored credential.

Same issue, Only on 2.19 - Downgraded back to 2.18.3 issue resolved, Please fix

It seems there’s a split as to whether this has fixed the issue or not - those that are still experiencing the issue, are you able to provide feedback and more detail on your setups so we can figure out what’s going on for you?

We are running multiple nodes with portainer agents as docker containers on multiple servers, portainer itself is running as docker container as well on a different node.

Using the webhook gets me this message: failed to deploy a docker compose stack 234: an error occurred while running unpacker container with exit code 255: authentication required

But clicking on repull and deploy in the ui does work and the webhook also works if the stack runs on the same server as portainer ui so it seems it may only be a problem with the agent.

Same problem 2.19.0 businesss edition

Thanks for raising the issue and all the updates. We are working on a fix and will be included in a patch release.

Internal Ref: EE-6150

Great, thanks - so it sounds like the issue is with existing stacks. I’ll need to do a bit more testing here and consult with the team, but I’ll come back to you once I learn more.

The webhook still does not work on 2.19.3, Failed to deploy a docker compose stack 234: an error occurred while running unpacker container with exit code 255: authentication required

Only manually redeploying in ui works.

I just tested the webhook on 2.19.3 and it seems to be working.

Running 2.19.2 and webhook other than replying with 204 No Content does nothing 😕

This is a separate bug, and should now be resolved with the 2.19.3 release.

I am also facing this issue with 2.19.1 (portainer/portainer-ee:2.19.1-alpine). I am able to deploy successfully. But after five minutes, the directory /data/portainer-compose-unpacker/stacks/<stack_name> is emptied, and I get the following error in portainer logs

2023/10/19 05:12PM ERR github.com/portainer/portainer-ee/api/scheduler/scheduler.go:113 > job returned an error, it will be rescheduled | error="failed to deploy a docker compose stack 98: an error occurred while running unpacker container with exit code 255: authentication required"