Problems deploying to vapor cloud

I’m having a problem deploying the TILApp project from the book to the Vapor cloud. I’ve tried to do the deploy as outlined in the book multiple times. It has deployed before but I have just completed the tasks chapter 6 and Configured the PostgreSQL database and can’t get it to deploy.
Any ideas?

app: TilApp
git: GitHub - RyanCallery/vaporPracticeNext
env: production
db: yes
replicas: 1
replica size: free
branch: master
build: update
Creating deployment [Done]
Connecting to build logs …
Waiting in Queue [Done]
Checkout branch ‘master’ [Done]
Verifying base folder [Done]
Selected swift version: 4.1.0 [Done]
Running swift package update [Done]
Building vapor (release) [Failed]
Compile Swift Module ‘App’ (7 sources)
/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/CSQLite.build/module.modulemap:2:14: warning: umbrella directory ‘/vapor/vaporpracticenext-production/code/.build/checkouts/sqlite.git–8681241352064503308/Sources/CSQLite/include’ not found
umbrella “/vapor/vaporpracticenext-production/code/.build/checkouts/sqlite.git–8681241352064503308/Sources/CSQLite/include”
^
Compile Swift Module ‘Run’ (1 sources)
/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/CSQLite.build/module.modulemap:2:14: warning: umbrella directory ‘/vapor/vaporpracticenext-production/code/.build/checkouts/sqlite.git–8681241352064503308/Sources/CSQLite/include’ not found
umbrella “/vapor/vaporpracticenext-production/code/.build/checkouts/sqlite.git–8681241352064503308/Sources/CSQLite/include”
^
Linking ./.build/x86_64-unknown-linux/release/Run
/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/Models/Todo.swift.o:/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/routes.swift.o:function _T03App4TodoC6Fluent5ModelAadEP5idKeys08WritableF4PathCyx2IDQzSgGvgZTW: error: undefined reference to ‘_T012FluentSQLite0B5ModelPAAE5idKeys08WritableE4PathCyxSiSgGvgZ’
/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/Models/Todo.swift.o:/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/routes.swift.o:function _T03App4TodoC6Fluent9MigrationAadEP7prepare3NIO15EventLoopFutureCyytG8Database_10ConnectionQZ2on_tFZTW: error: undefined reference to ‘_T06SQLite0A8DatabaseC6Fluent16SchemaSupporting0cA0WP’
/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/Models/Todo.swift.o:/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/routes.swift.o:function _T03App4TodoC6Fluent9MigrationAadEP6revert3NIO15EventLoopFutureCyytG8Database_10ConnectionQZ2on_tFZTW: error: undefined reference to ‘_T06SQLite0A8DatabaseC6Fluent16SchemaSupporting0cA0WP’
/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/Models/Todo.swift.o:/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/routes.swift.o:_T03App4TodoC6Fluent9MigrationAAWP: error: undefined reference to ‘_T06SQLite0A8DatabaseCMa’
/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/Models/Todo.swift.o:/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/routes.swift.o:_T03App4TodoC6Fluent9MigrationAAWP: error: undefined reference to ‘_T06SQLite0A8DatabaseC6Fluent19MigrationSupporting0cA0Wa’
/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/Models/Todo.swift.o:/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/routes.swift.o:_T03App4TodoC6Fluent5ModelAAWP: error: undefined reference to ‘_T06SQLite0A8DatabaseCMa’
/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/Models/Todo.swift.o:/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/routes.swift.o:_T03App4TodoC6Fluent5ModelAAWP: error: undefined reference to ‘_T06SQLite0A8DatabaseC6Fluent15QuerySupporting0cA0Wa’
/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/Models/Todo.swift.o(.data.rel.ro+0x398): error: undefined reference to ‘_T012FluentSQLite0B5TableMp’
/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/Models/Todo.swift.o(.data.rel.ro+0x3a0): error: undefined reference to ‘_T012FluentSQLite01_B5ModelMp’
/vapor/vaporpracticenext-production/code/.build/x86_64-unknown-linux/release/App.build/Models/Todo.swift.o(.data.rel.ro+0x3a8): error: undefined reference to ‘_T012FluentSQLite0B5ModelMp’
clang: error: linker command failed with exit code 1 (use -v to see invocation)
:0: error: link command failed with exit code 1 (use -v to see invocation)
error: terminated(1): /swift/4.1.0/usr/bin/swift-build-tool -f /vapor/vaporpracticenext-production/code/.build/release.yaml main output:

Error: deploy failed.

@0xtim Can you please help with this when you get a chance? Thank you - much appreciated! :]

@ryancallery

Delete the following source files:

  • TodoController.swift (in Sources/App/Controllers folder)
  • Todo.swift (in Sources/App/Models folder)

Those were generated with the “vapor new xxx” command, but are not used in TILApp. The Todo.swift model imports FluentSQLite. That was removed when you updated Package.swift for PostgreSQL, but the compiler is still looking for it when compiling Todo.swift.

Hope that helps. Have fun!

1 Like

Is this working now?

Thanks for the reply. It is still not working. I am able to get it to build but when I try to run it I’m getting an error involving docker

Thread 1: Fatal error: Error raised at top level: :warning: PostgreSQL Error: password authentication failed for user “vapor”

  • id: PostgreSQLError.server.fatal.auth_failed

This is the code I entered to set up my docker container

docker run --name postgres -e POSTGRES_DB=vapor
-e POSTGRES_USER=vapor -e
POSTGRES_PASSWORD=password
-p 5432:5432 -d postgres

This is the object I set up in config.swift

let dataBaseConfig = PostgreSQLDatabaseConfig(
    hostname: "localhost",
    username: "vapor",
    database: "vapor",
    password: "password"
)
let database = PostgreSQLDatabase(config: dataBaseConfig)
databases.add(database: database, as: .psql)
services.register(databases)

I have attempted multiple vapor updates. Am I supposed to be using other credentials for authorization?

@0xtim Do you have any feedback about this? Thank you - much appreciated! :]

Hi,

Sorry for the delay. If you haven’t fixed it:

Your config code looks valid. Do you know what version of Postgres you’ve downloaded? And can you connect with a different Postgres client?

The only thing that looks suspicious to me is the line breaks in your docker run command. It may be that it’s missed the password off, but you’d get an error normally if the rest of the command wasn’t supplied.