Hi everyone,
I’m encountering a strange issue when trying to create a machine in a newly created Fly app using the v1 Machines API. The machine gets stuck in the created state and never starts.
When I send a POST request to /v1/apps/my-new-app/machines
, the API call returns a successful 200 response and a machine object. However, looking at fly status
or the dashboard, the machine remains in the created state indefinitely (I’ve waited over 30 minutes). It never transitions to started.
Once in this state, the machine is completely unresponsive. I can’t interact with it via fly machine stop/destroy or through the dashboard.
Here’s the weird part: this seems to be specific to the newly created app.
-
Works on Old App: If I run the exact same API call but target an older, existing app (
my-old-app
), it works perfectly. The machine starts up as expected. -
fly deploy
Works: Deploying to the new app (my-new-app
) using fly deploy works correctly. This suggests the app itself is fine, but there’s an issue with my direct Machines API call. -
Image is Not the Problem: The specific Docker image I’m using is not the issue. I can deploy it successfully to
my-old-app
via the Machines API. -
Region Change Has No Effect: I have tried changing the region in the API call, but the result is the same.
Here is the curl request I’m using, with sensitive information like app names, image names, and the auth token redacted.
curl --request POST \
--url https://api.machines.dev/v1/apps/my-new-app/machines \
--header 'Authorization: Bearer [REDACTED_FLY_TOKEN]' \
--header 'Content-Type: application/json' \
--data '{
"config": {
"auto_destroy": true,
"containers": [
{
"name": "pipecat",
"image": "registry.fly.io/my-new-app:deployment-xxxxxxxx",
"env": {
"PORT": "7860",
},
"secrets": [
{ "env_var": "REDACTED" }
]
}
],
"restart": {
"policy": "no"
},
"guest": {
"cpu_kind": "performance",
"cpus": 1,
"memory_mb": 2048
},
"services": [
{
"internal_port": 7860,
"protocol": "tcp",
"ports": [
{
"port": 80,
"handlers": ["http"],
"force_https": true
},
{
"port": 443,
"handlers": ["tls", "http"]
}
]
}
],
"checks": {
"httpget": {
"type": "http",
"port": 7860,
"method": "GET",
"path": "/",
"interval": "15s",
"timeout": "10s"
}
}
},
"region": "iad, usa"
}
'
Has anyone encountered this behavior before? Is there a step I might be missing when setting up a new app that is required for direct Machines API interaction? It seems like fly deploy might be performing an extra initialization step that I am not.
Any help or insight would be greatly appreciated!
Thanks.