3

I've been working with Vapor and Heroku for a few weeks now and it is all going well. Vapor is fab! ;] I have been successfully updating the app on Heroku using git push heroku master until yesterday evening when I started to get this error:

$ git push heroku master
Counting objects: 26, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (24/24), done.
Writing objects: 100% (26/26), 7.37 KiB | 0 bytes/s, done.
Total 26 (delta 15), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Swift app detected
remote: Cloning into 'swiftenv'...
remote: Swift 3 Heroku Installer
remote:   Version: 3.0.2
remote:   Operating System: ubuntu1404
remote:  Installing Swiftenv
remote: Cloning into '/app/.swiftenv'...
remote:  Installing Swift
remote: Downloading https://swift.org/builds/swift-3.0.2-release/ubuntu1404/swift-3.0.2-RELEASE/swift-3.0.2-RELEASE-ubuntu14.04.tar.gz
remote: /tmp/swiftenv-3.0.2- /tmp/build_577666a1ce2003bd1d820e031bc0f306
remote:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
remote:                                  Dload  Upload   Total   Spent    Left  Speed
remote: 100  113M  100  113M    0     0  8057k      0  0:00:14  0:00:14 --:--:-- 8613k
remote: /tmp/build_577666a1ce2003bd1d820e031bc0f306
remote: 3.0.2 has been installed.
remote: ✅  Done
remote: precompile
remote: -----> Installing toolbox
remote: Downloading...
remote: Compiling...
remote: <unknown>:0: error: build had 1 command failures
remote: swift-build: error: exit(1): /app/.swiftenv/versions/3.0.2/usr/bin/swift-build-tool -f /tmp/build_577666a1ce2003bd1d820e031bc0f306/vapor-toolbox/.build/debug.yaml
remote:  !     Push rejected, failed to compile Swift app.
remote: 
remote:  !     Push failed
remote: Verifying deploy....
remote: 
remote: !   Push rejected to zzzzzzzz.
remote: 
To https://git.heroku.com/zzzzzzzz.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/zzzzzzzz.git'

The master branch of my repo is clean and up to date with no commits pending from elsewhere (there's only be working on the code).

Any thoughts would be greatly appreciated.

Thanks --TJ

TJ Shae
  • 193
  • 7
  • 1
    I don't have anything intelligent to provide (but that won't stop me :)) Are you running on a Mac? Could this be because you've updated your local environment to Swift 3.1 or something else has been updated either on your side of the fence or at Heroku? Apart from that, it seems you might not be alone: https://github.com/vapor/vapor/issues/766 (see the last couple of comments). Sorry I can't provide an actual solution. – pbodsk Mar 31 '17 at 08:28
  • Hi. Thanks for the response. Yes, I'm on a Mac with Swift 3.1. Can't see how that would make a difference though as the remote build is using 3.0.2 as it should be (I believe). – TJ Shae Mar 31 '17 at 08:52

1 Answers1

1

Hah! The guys on the Vapor Slack have sorted it. pbodsk, you were correct in that it was a Swift 3.1 issue.

You need to create a .swift-version file in the root directory of your Vapor project. The content of the file is simply:

3.1

When this is pushed to Heroku, it will compile using the correct version of Swift.

Please be aware that you'll also need to do this if you are having this issue:

vapor toolbox broken after upgrading swift

--TJ

Community
  • 1
  • 1
TJ Shae
  • 193
  • 7