Drone.io cannot accept stage" error="400 Bad Request" with drone 2

Hi,

I’m migrating to the new drone 2 version from 1.x. I’m testing a fairly simple pipeline that builds and publish a docker image. When I launch a build being it by pushing a change or using the + NEW BUILD button on the project’s pipeline page on the new dashboard I get a blank page, and on the agent logs I can see this error:

drone-agent_1  | time="2021-09-22T19:19:52-05:00" level=error msg="cannot accept stage" error="400 Bad Request" stage.id=1 stage.name=hello-world stage.number=1 thread=1
drone-agent_1  | time="2021-09-22T19:19:52-05:00" level=debug msg="poller: request stage from remote server" thread=1
drone-agent_1  | time="2021-09-22T19:19:52-05:00" level=debug msg="stage received" stage.id=1 stage.name=hello-world stage.number=1 thread=2

I’m running the server and agent on docker, so I first tried to use the same volumes with the new images and got that result. Then I tried with a clean setup (deleted the docker volumes, activated the project drone repository and added dockerhub secrets) and very basic pipeline that just builds an image and pushes it to docker hub but got the same errors.

This is the docker-compose file I use:

version: '3.8'
services:
  drone:
    image: 'drone/drone:2'
    env_file:
      - .env
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./volumes/drone:/data"
      - '/etc/localtime:/etc/localtime:ro'
    ports:
      - 80:80
  drone-agent:
    image: drone/drone-runner-docker:1
    command: agent
    depends_on:
      - drone
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - '/etc/localtime:/etc/localtime:ro'
    env_file:
      - .env

The contents of the .env file:


DRONE_SERVER_HOST=<omitted>
DRONE_SERVER_PROTO=http
DRONE_GITHUB_CLIENT_ID=<omitted>
DRONE_GITHUB_CLIENT_SECRET=<omitted>
DRONE_RPC_SECRET=<omitted>
DRONE_TLS_AUTOCERT=false
DRONE_USER_CREATE=username:<omitted>,admin:true
DRONE_DEBUG=true
DRONE_TRACE=true
#DRONE_RPC_DUMP_HTTP=true
#DRONE_RPC_DUMP_HTTP_BODY=true

# Agent
DRONE_RUNNER_CAPACITY=2
DRONE_RPC_HOST=<omitted>
DRONE_RPC_PROTO=http
DRONE_RUNNER_NAME="Drone.io agent"
#DRONE_AGENTS_ENABLED=true

This is the pipeline:

kind: pipeline
name: hello-world

steps:
- name: docker  
  image: plugins/docker
  settings:
    registry: docker.io
    repo: <omitted>/docker-hello-world
    username:
      from_secret: docker_username
    password:
      from_secret: docker_password
    tags: 
      - latest

Looking at the documentation it seems that the syntax has not changed, so I’m really lost with what is triggering this error. Any ideas are much appreciated.

Thanks.

Does anyone has a basic example of drone 2 usage that I could use as a guide ? maybe that way I can find what’s wrong with my code.

@bradrydzewski do you have any insights on what could be going on ? this setup works fine with drone 1 but not with drone 2.