[Heroku] - Deploying Vapor 4

Hi! I finished updating my project from “Vapor 3” to “Vapor 4” and I am trying to deploy on Heroku but the following error is generated:

Captura de Pantalla 2021-04-10 a la(s) 18.50.48

Has anyone been through the same thing?

I would appreciate a help.

@ingricharddavid if you want to use SQLite on Heroku then you’ll need to install libsqlite-dev. However you really don’t want to use SQLite on Heroku and there’s a reason it’s not supported. Every time your Heroku instance restarts (after 30 mins of inactivity on the free plan or whenever they move it across servers or you deploy a new build) your database will be wiped. Heroku provides no persistence storage so SQLite is not a good fit

Hi @0xtim thanks for answering. Ok, I will consider installing libsqlite-dev. However, I understand that this should be done automatically because it is specified in the Package “sqlite-nio/Package.swift at main · vapor/sqlite-nio · GitHub”.

Regarding the heroku so far I was using it with Vapor 3 without problems since what I need from SQLite is to save data while the server is deployed. SQLite allows you to store data in an orderly way that you can easily query with SQL :pensive:.

Finally what I did at the moment with Vapor 4 is to use the Cache to store information, however, this has many limitations such as the fact that you cannot get the data from the Cache if you do not have the key, there are only get and set functions. For now I will leave it at that since the current implementation is somewhat simple, however, when my business logic grows, it would be less than optimal to manipulate all the data in Cache, not so much for the matter of speed but for the structure of the data and the way they are related.

For now it works, thank you very much for your answer. :+1:

I don’t think the system package stuff is particularly reliable (e.g. the user running swift build probably doesn’t (and definitely shouldn’t!) have permission to install a missing package). Here’s a link to a Discord thread that walks you through the process.

If you save data into SQLite on Heroku, you will lose it. There’s no way around it unfortunately and I’d strongly recommend using a different database instead. Both Postgres and MySQL work well with Heroku

It’s worth noting that libsqlite-dev is an operating system package and not part of Vapor. SwiftPM can’t install it and without it, Vapor’s SQLite support won’t compile.