fly launch or deploy error: failed to fetch an image or build from source

Hi, I’m new to fly.io and I’m trying to deploy my first project. It’s a vapor server (built with swift). When I run fly launch or fly deploy I am getting a couple of errors. The first error that shows up is:

255.8 /build/Sources/App/Models/ScheduleTextJob.swift:17:9: warning: initialization of immutable value ‘repeatingTask’ was never used; consider replacing with assignment to ‘_’ or removing it
255.8 let repeatingTask = app.eventLoopGroup.next().scheduleRepeatedTask(
255.8 ^~~~~~~~~
255.8 _
255.8 error: fatalError

Then fly continues building but ends with this error:

Error: failed to fetch an image or build from source: error building: failed to solve: process “/bin/sh -c swift build -c release --static-swift-stdlib -Xlinker -ljemalloc” did not complete successfully: exit code: 1

I tried using flyctl doctor and this got me further along in the process than before using doctor, but I still end up with the above error. After the first failure I ran fly apps destroy textalertserver and then fly launch, only to encounter the error again. Can anyone help point me in the right direction? My vapor server is currently running on a mac server on HostMyApple and it works fine. I really need to migrate to fly.io though. Any help would be greatly appreciated. Do I need to edit my Docker or docker-compose.yml files somehow?

The second error might be happening due to the first error. Do you have other errors/warnings between these two errors?

Actually the the errors that come first are these:

255.8 /build/Sources/App/Models/Resident.swift:97:30: error: value of type ‘Date’ has no member ‘formatted’
255.8 return (newDate?.formatted(date: .numeric, time: .omitted))!
255.8 ~~~~~~~~ ^~~~~~~~~
255.8 /build/Sources/App/Models/Resident.swift:97:47: error: cannot infer contextual base in reference to member ‘numeric’
255.8 return (newDate?.formatted(date: .numeric, time: .omitted))!
255.8 ~^~~~~~~
255.8 /build/Sources/App/Models/Resident.swift:97:63: error: cannot infer contextual base in reference to member ‘omitted’
255.8 return (newDate?.formatted(date: .numeric, time: .omitted))!
255.8 ~^~~~~~~
255.8 /build/Sources/App/Models/Resident.swift:119:26: error: value of type ‘Date’ has no member ‘formatted’
255.8 return (rentDate.formatted(date: .abbreviated, time: .omitted))
255.8 ~~~~~~~~ ^~~~~~~~~
255.8 /build/Sources/App/Models/Resident.swift:119:43: error: cannot infer contextual base in reference to member ‘abbreviated’
255.8 return (rentDate.formatted(date: .abbreviated, time: .omitted))
255.8 ~^~~~~~~~~~~
255.8 /build/Sources/App/Models/Resident.swift:119:63: error: cannot infer contextual base in reference to member ‘omitted’
255.8 return (rentDate.formatted(date: .abbreviated, time: .omitted))

Nothing besides those

Thanks! You do need to fix these errors first to build the project.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.