Heroku + Geo Library - type `geography` can not be handled

Hi all,

I’m using a Postgres extension for the first time by using postGIS and the great Geo library (https://github.com/bryanjos/geo) by Bryan Joseph and while local development was fine, I’m getting the following message when trying to access a deployed Heroku instance:

[error] Postgrex.Protocol (#PID<0.314.0>) disconnected: ** (RuntimeError) type `geography` can not be handled by the types module Ecto.Adapters.Postgres.TypeModule

My prod.exs file looks like:

config :example, Example.Repo,
adapter: Ecto.Adapters.Postgres,
url: System.get_env("DATABASE_URL"),
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "20"),
ssl: true,
extensions: [{Geo.PostGIS.Extension, library: Geo}]

I’ve ensured that the PostGIS extension has been created on the Heroku database and tried adding the ‘extensions’ property to the config above, but still haven’t had any luck. Any help is very much appreciated!

Haha, as is always the case, I only just noticed a reference to Postgres Extensions in the console after posting this. Will investigate and report back.

For any future devs coming here from their search engine of choice, the answer is to create a new postgrex_types.ex file under lib/project_name/ with the following:

Postgrex.Types.define(Projectname.PostgrexTypes, [Geo.PostGIS.Extension] ++ Ecto.Adapters.Postgres.extensions(), json: Poison)

I have this issue but only on my server, locally I dont have this issue.
Heres by bug ticket https://github.com/bryanjos/geo_postgis/issues/4


EDIT: I forgot the prod config

extensions: [{Geo.PostGIS.Extension, library: Geo}]