Search code examples
swiftherokudiscordvapor

Can't push swift package to Heroku using Vapor


I'm trying to push a Swift package to Heroku using the Vapor buildpack (https://github.com/vapor-community/heroku-buildpack/tree/master), but I keep getting this error:

error: terminated(1): /app/tmp/cache/heroku-18/swiftenv/versions/4.2/usr/bin/swift-build-tool -f /tmp/build_1041959f11306dce64ad9d4712e1d962/.build/debug.yaml main output:

I wrote the package using Swift 5.2, but Heroku insists on using Swift 4.2. I have confirmed that the buildpack is compatible with Swift 5.2, and I've set the .swift-version file to 5.2, as well as the first line of my Package.swift file.

Here is the Package.swift file:

    // swift-tools-version:5.2
    // The swift-tools-version declares the minimum version of Swift required to build this package.

    import PackageDescription

    let package = Package(
name: "TurnipBot",
dependencies: [
    // Dependencies declare other packages that this package depends on.
    .package(url: "https://github.com/Azoy/Sword", .branch("master"))

],
targets: [
    // Targets are the basic building blocks of a package. A target can define a module or a test suite.
    // Targets can depend on other targets in this package, and on products in packages which this package depends on.
    .target(
        name: "TurnipBot",
        dependencies: ["Sword"]),
    .testTarget(
        name: "TurnipBotTests",
        dependencies: ["TurnipBot"]),
]
    )

Solution

  • Did you definitely commit the .swift-version file? And is it spelt right etc? I've used it in one of my apps and it's deployed fine