Failed to create release (422)

I’m getting errors trying to deploy a newly created app.

The app is build using local Docker engine, due to the need of private repo credentials.

$ fly deploy --local-only --build-secret GITHUB_TOKEN=$GITHUB_TOKEN
==> Verifying app config
Validating /[redacted]/fly.toml
✓ Configuration is valid
--> Verified app config
==> Building image
Searching for image '[redacted]' locally...
image found: sha256:[redacted]
==> Pushing image to fly
The push refers to repository [registry.fly.io/[redacted]]
fb0f4359b4a4: Layer already exists 
dc5335958f38: Layer already exists 
5309779bc34f: Layer already exists 
6da200c05038: Layer already exists 
5b3a2081ac9f: Layer already exists 
d6ae510f3ef7: Layer already exists 
75c72c774761: Layer already exists 
45f3ea5848e8: Layer already exists 
deployment-01KN6WGNDHXDTX1BGYW7KJE2QB: digest: sha256:[redacted] size: 1994
--> Pushing image done

Watch your deployment at https://fly.io/apps/[redacted]/monitoring

Error: failed to create release (status 422): {"error":"422 Unprocessable Entity"}

I’ve ensured that the cli version is current

$ fly version update
Already running latest flyctl v0.4.29

Also checked diagnostics and configuration validation

$ fly doctor
Testing authentication token... PASSED
Testing flyctl agent... PASSED
Testing local Docker instance... PASSED
Pinging WireGuard gateway (give us a sec)... PASSED
Testing WireGuard DNS... PASSED
Testing WireGuard Flaps... PASSED

App specific checks for [redacted]:
Checking that app has ip addresses allocated... PASSED
Checking A record for [redacted].fly.dev... PASSED
Checking AAAA record for [redacted].fly.dev... PASSED

Build checks for [redacted]:
Checking docker context size (this may take little bit)... PASSED (32 B)

Since all that worked, I tried with LOG_LEVEL=debug to gather more details

$ LOG_LEVEL=debug fly deploy --local-only --build-secret GITHUB_TOKEN=$GITHUB_TOKEN --verbose
...
DEBUG --> POST https://api.fly.io/api/v1/releases
DEBUG {
  "app_name": "[redacted]",
  "build_id": 19367236,
  "definition": {
    "app": "[redacted]",
    "primary_region": "ams",
    "build": {
      "image": "[redacted]"
    },
    "env": {
    },
    "http_service": {
      "internal_port": 8080,
      "force_https": true,
      "auto_stop_machines": true,
      "auto_start_machines": true,
      "min_machines_running": 0,
      "processes": [
        "app"
      ]
    },
    "vm": [
      {
        "memory": "512mb",
        "cpus": 1,
        "memory_mb": 512
      }
    ]
  },
  "image": "registry.fly.io/[redacted]:deployment-01KN6WSDR2VEQSWMPFXXQT2W60",
  "strategy": "ROLLING"
}

DEBUG {}
DEBUG <-- 422 https://api.fly.io/api/v1/releases (935.7ms)

DEBUG   <-- https://api.fly.io/api/v1/releases: {"error":"422 Unprocessable Entity"}
DEBUG Task manager done
DEBUG done monitoring tokens
DEBUG querying for host issues resulted to []
DEBUG querying for statuspage incidents resulted to &{[]}
Error: failed to create release (status 422): {"error":"422 Unprocessable Entity"}

So it seems the actual issue is that POST to /api/v1/releases. The body seems fine, although I can’t find that deployment in the registry when navigating in the UI.

Has anyone been through something similar? And hints?

Thanks.

Alright, I’m answering this one myself in case it helps someone in the future.

This was a classic issue between the keyboard and the chair… I’m not building from a Dockerfile but instead pulling a Docker image. And I’m on an ARM Mac, which means that when I do docker pull image I get the arm64 one. Just adding --platform amd64 when pulling the image fixed this!

1 Like