portainer: error reading server preface: http2: frame too large

Before you start please confirm the following.

Problem Description

Hi,

When I define new stack like this:

services:
  test:
    build: https://ghp_TOKEN@github.com/USERNAME/REPONAME.git#:FOLDER/SUBFOLDER

And deploy stack, it gives following error: failed to deploy a stack: listing workers for Build: failed to list workers: Unavailable: connection error: desc = "error reading server preface: http2: frame too large"

If I put all this into file docker-compose.yaml locally on server and run docker compose up then deployment is successful.

Expected Behavior

Stack should be build properly as if I would build it from bash directly on server.

Actual Behavior

Stack throws error: failed to deploy a stack: listing workers for Build: failed to list workers: Unavailable: connection error: desc = "error reading server preface: http2: frame too large"

Steps to Reproduce

  1. Login to portainer
  2. Go to Stacks -> Add Stack
  3. Select Web Editor and paste there:
services:
  test:
    build: https://ghp_TOKEN@github.com/USERNAME/REPONAME.git#:FOLDER/SUBFOLDER
  1. Give it a name
  2. Press on Deploy the stack button.

Portainer logs or screenshots

image

Portainer version

2.19.1

Portainer Edition

Community Edition (CE)

Platform and Version

Docker Standalone 24.0.7

OS and Architecture

linux x86_64 Debian GNU/Linux 11 (bullseye)

Browser

Firefox 119.0 64-bit

What command did you use to deploy Portainer?

docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

Additional Information

No response

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 10
  • Comments: 47 (3 by maintainers)

Most upvoted comments

Same problem here with the newest portainer version 2.27.3 lts…

Facing same issue on latest portainer/portainer-agent combo. After hours of debugging this, I found it’s rather a buildkit issue.

Temporary workaround is to fall back to legacy build by setting DOCKER_BUILDKIT: 0 env variable. If your portainer is deployed via docker, you can do it following way in compose file:

services:
  portainer:
    container_name: portainer
    hostname: portainer
    image: portainer/portainer-ce:lts
    environment:
      DOCKER_BUILDKIT: 0

Tagging jamescarppe

Same here using the latest version of Portainer BE. Seems to me like the Agent is that the GRPC version used in Portainer is buggy. In my case my Portainer instance is talking to a Portainer Agent on the other side of a Site-To-Site VPN, which probably changes the frame size. Portainer is the only app that has issues with this and I’ve been using this setup for the past 5 years without issues with other apps. Interestingly Portainer used to work perfectly fine with this setup before. It must have been a recent update who broke it for me. I even tried updating the Portainer Agent to the latest version, with the same result.

The error is always:

Failed to deploy a stack: compose build operation failed: listing workers for Build: failed to list workers: Unavailable: connection error: desc = "error reading server preface: http2: frame too large"

This did not work for me. DOCKER_BUILDKIT=0 seems to cause issues when your github repository contains a docker compose with build in it:

        image: IMAGE:TAG
        pull_policy: always
        build:
            dockerfile: Dockerfile
            context: ./src
            args:
                VERSION: ${VERSION:-LTSVERSION}

I let github build and store my images and Portainer retrieve those images.

DOCKER_BUILDKIT=0

Deployment error
Failed to deploy a stack: compose build operation failed: Status: the --mount option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to learn how to build images with BuildKit enabled, Code: 1

DOCKER_BUILDKIT=1

 "error reading server preface: http2: failed reading the frame payload: %!w(<nil>), note that the frame header looked like an HTTP/1.1 header"

Getting the same error on Community Edition v 2.27.4 LTS

Deployment error
Failed to deploy a stack: compose build operation failed: listing workers for Build: failed to list workers: Unavailable: connection error: desc = "error reading server preface: http2: frame too large"

I am getting this error in 2.27.4 trying to re-deploy to a remote docker instance over portainer-agent. The instance used to work before I updated about a week ago.

My docker-compose.yaml:

services:
  open-webui:
    build:
      context: .
      args:
        OLLAMA_BASE_URL: '/ollama'
      dockerfile: Dockerfile
    image: ghcr.io/open-webui/open-webui:${WEBUI_DOCKER_TAG-latest}
    container_name: open-webui
    volumes:
      - open-webui:/app/backend/data
    ports:
      - ${OPEN_WEBUI_PORT-3000}:8080
    environment:
      - 'OLLAMA_BASE_URL=http://ai00.myinternaldomain.com:11434'
      - 'WEBUI_SECRET_KEY='
    extra_hosts:
      - host.docker.internal:host-gateway
    restart: unless-stopped

volumes:
  open-webui: {}

Placing this in a docker-compose.yaml and running docker compose up seems to work fine. Agent is also 2.27.4.

Hi, I am experiencing the same issue. I resolved it simply by enabling Enable relative path volumes in the stack.

Any workaround for CE edition ?

This is likely due to your build requiring relative path support in order to build. Relative path volumes is a feature we provide in our Business Edition (which you can get for free for up to 3 nodes), and may help you work around this error.