Unable to sync repos from GitLab

I’m starting with Drone CI, i tested already with Gitea, it worked well (though sometimes some jobs stayed in pending status for ever). Now i’m trying to use (a brand new instance of) Drone with GitLab.

This is my compose file (It’s deployed on Docker Swarm and proxied by Traefik, this same approach worked for Gitea)

# Stack name: drone
version: "3.4"
networks:
  the-force:
    external: true
  back:
    driver: overlay
    driver_opts:
      encrypted: ""
    internal: true
    attachable: true
volumes:
  db:
    driver: nfs
    driver_opts:
      share: "192.168.1.7:/drone/db"
services:
  server:
    image: drone/drone:0.8
    networks:
      - back
      - the-force
    ports:
      - target: 9000
        published: 9000
        protocol: tcp
        mode: ingress
    environment:
      - DRONE_DATABASE_DATASOURCE=postgres://[USER]:[REDACTED]@drone_data:5432/[DB]?sslmode=disable
      - DRONE_DATABASE_DRIVER=postgres
      - DRONE_ADMIN=[USER]
      - DRONE_DEBUG=true
      - DRONE_GITLAB=true
      - DRONE_GITLAB_CLIENT=[REDACTED]
      - DRONE_GITLAB_SECRET=[REDACTED]
      - DRONE_GITLAB_SKIP_VERIFY=false
      - DRONE_GITLAB_URL=https://gitlab.com
      - DRONE_HOST=https://drone.domain.com
      - DRONE_OPEN=true
      - DRONE_SECRET=[REDACTED]
      - GIN_MODE=release
    deploy:
      labels:
        - "traefik.backend.loadbalancer.stickiness=true"
        - "traefik.backend.loadbalancer.swarm=true"
        - "traefik.backend=ci-server"
        - "traefik.docker.network=the-force"
        - "traefik.frontend.entrypoints=https,wss"
        - "traefik.frontend.passHostHeader=true"
        - "traefik.frontend.rule=Host:drone.domain.com"
        - "traefik.port=8000"
      placement:
        constraints:
          - node.labels.arch == amd64
      restart_policy:
        condition: any
      update_config:
        parallelism: 1
        delay: 10s
  data:
    image: postgres:9-alpine
    networks:
      - back
    volumes:
      - data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=[DB]
      - POSTGRES_PASSWORD=[REDACTED]
      - POSTGRES_USER=[USER]
    deploy:
      placement:
        constraints:
          - node.labels.arch == amd64
      restart_policy:
        condition: any
      update_config:
        parallelism: 1
        delay: 10s

After inspecting the service I found out GitLab returned a 502 error

Logs

$ docker service logs -f drone_server
[email protected]    | time="2018-03-20T05:34:55Z" level=debug msg="user feed: connection opened" 
[email protected]    | time="2018-03-20T05:35:00Z" level=debug msg="sync error: ulm0: *Gitlab.buildAndExecRequest failed: <502> https://gitlab.com/api/v4/projects?membership=true&page=1&per_page=100" 
[email protected]    | time="2018-03-20T05:35:00Z" level=info ip=10.255.0.2 latency=1m1.627969757s method=GET path="/api/user/feed" status=200 time="2018-03-20T05:35:00Z" user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36" 
[email protected]    | time="2018-03-20T05:35:01Z" level=info ip=10.255.0.2 latency=5.120817ms method=GET path="/api/user/repos" status=200 time="2018-03-20T05:35:01Z" user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36" 
[email protected]    | time="2018-03-20T05:35:05Z" level=debug msg="user feed: connection closed" 
[email protected]    | time="2018-03-20T05:35:05Z" level=info ip=10.255.0.2 latency=9.988104634s method=GET path="/stream/events" status=200 time="2018-03-20T05:35:05Z" user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko; Google Web Preview) Chrome/41.0.2272.118 Safari/537.36" 
[email protected]    | time="2018-03-20T05:35:15Z" level=debug msg="sync begin: ulm0" 
[email protected]    | time="2018-03-20T05:36:17Z" level=debug msg="sync error: ulm0: *Gitlab.buildAndExecRequest failed: <502> https://gitlab.com/api/v4/projects?membership=true&page=1&per_page=100" 
[email protected]    | time="2018-03-20T05:36:17Z" level=info ip=10.255.0.2 latency=1m2.510378217s method=GET path="/api/user/repos" status=200 time="2018-03-20T05:36:17Z" user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36"

This is all i got so far

My feed is not showing any repositories at all (clicked the Synchronize button several time already and nothing)

502 is a bad gateway error which typically comes from a reverse proxy or load balancer not being able to properly connect with the upstream, typically due to a timeout.