-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
{:error, "Table 'requests' could not be found"} #31
Comments
I'm experiencing the same issue. It seems in defmodule PhoenixAnalytics.Queries.Table do
@moduledoc false
alias PhoenixAnalytics.Services.Utility
@db_alias "postgres_db"
@requests if Utility.mode() == :duck_postgres, do: "#{@db_alias}.requests", else: "requests"
def name() do
@requests
end
def create_requests do
query = """
CREATE TABLE IF NOT EXISTS #{@requests} (
request_id UUID PRIMARY KEY,
method VARCHAR NOT NULL,
... |
docs to the so basically if both duck and postgres are configured that db_alias is used. in my case indeed both are used. question is what's different from my dev to prod. |
Hi @KristerV , Thank you for raising issue, I never worked with fly io. Could you please provide example how connection to db looks there? As I can add simple parameter "ignore_alias" or something similar. |
What confuses me is that the mode is determined from the config: PhoenixAnalytics/lib/phoenix_analytics/services/utility.ex Lines 105 to 114 in 6b94e9d
But in my config I don't have postgres configured.. edit: well i deployed a debug version of this repo (master) and this particular error is fixed apparently. it now knows it's not using postgres in the config. so the current state is better than the last version (0.2.1). yet i get another error. from the code it seems like it's looking for the DuckDB table, but it doesn't exist.
so I SSH into the container and find that the duckdb file is right next to the executables, which are not persistent. in fact now that i think about it the whole container is ephermal. and creating a volume for it doesn't really make sense as fly.io gives you multiple physical machines per app by default. no point in scaling down. so i'm going to go the other way and see if i can configure this on postgres. |
if I configure like this: config :phoenix_analytics,
app_domain: System.get_env("PHX_HOST") || "example.com",
postgres_conn: "dbname=phoenixanalytics user=postgres password=postgres host=localhost",
cache_ttl: 120 Then I just get an error:
So this means that PostgreSQL alone isn't enough. It must have DuckDB configured also (but why?), in which case I still get the error in the above post. I'm full of frustration. All in all it seems PhoenixAnalytics does not support fly.io or clusters. @lalabuy948 if you want to debug this maybe it makes sense to try fly.io? it's very popular in the Elixir community. They have a free tier and to deploy all you do is |
Hi @KristerV Could you add as well duck db path into your config? In case you use Postgres as backend, duck db file will be empty, but it's still needed for duck db to operate properly. |
okay, so config.exs
runtime.exs
so both postgres and duck have configs. but still same error:
what else can we try? |
Following up on that issue, I made a PR where I introduced an option not to touch disk at all. I need to run performance tests and if it's gonna be ok, i will add it in next release. |
Hey @lalabuy948 , I appear to be having the same/similar issue as mentioned here Locally it's working but not in Fly.io
config :phoenix_analytics,
app_domain: "example.com",
postgres_conn: System.get_env("POSTGRES_CONN"),
in_memory: true Note I am using an entirely different database in a separate app for analytics: defmodule App.AnalyticsRepo.Migrations.AddPhoenixAnalytics do
use Ecto.Migration
def up, do: PhoenixAnalytics.Migration.up()
def down, do: PhoenixAnalytics.Migration.down()
end Logs:
What's also annoying is that it's just printing the migration error so the migration succeeds despite not creating the My understanding is that this is only using postgres, not duckdb which seems odd that the only modes are |
Hi @capoccias , indeed you are right. I think issue that I hard codded alias PhoenixAnalytics.Services.Utility
@db_alias "postgres_db" Which I guess can be different.. What would most optimal way for you to add this db prefix? |
Hey @lalabuy948 , I'm at a bit of a loss as to what the fix would be here I've tried manually creating the |
Im also struggling with getting this to work with postgres only Also would be nice to use |
@lalabuy948 any updates for this? Im having same problem as @capoccias and cannot get it to work on Fly.io |
Hey, great library. I almost started writing this myself, but glad I didn't, because yours is so much better than what I had imagined.
So. Works in dev, deployed to fly.io and it produces an error. No events are logged, but the page opens.
and then some lines later it's
I would suspect that the migrations haven't been run, but as you know fly.io handles that and I haven't had any issues with migrations before.
Just to be clear I do have this migration.
I checked manually and
select * from schema_migrations;
confirms the migrations have run.and my config.exs is
I have not set the DUCKDB_PATH, as I understand there is no need? Prod does have HOST configured.
The text was updated successfully, but these errors were encountered: