Skip to content
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

encountering " protocol Enumerable not implemented for nil of type Atom" while running the docker-compose with external database #10007

Closed
SorrawitRUNGRUJEE opened this issue May 2, 2024 · 6 comments
Labels
waiting on feedback Waiting for original opener to respond if bug is fixed

Comments

@SorrawitRUNGRUJEE
Copy link

SorrawitRUNGRUJEE commented May 2, 2024

Description

I am trying to run blockscout with docker-compose -f external-db.yml up and then the following error shows up from the attached console

stats | 2024-05-02T06:30:23.959183Z ERROR stats_server: service failed with error: Connection Error: error communicating with database: failed to lookup address information: Name or service not known
stats | Error: Connection Error: error communicating with database: failed to lookup address information: Name or service not known
stats |
stats | Caused by:
stats | error communicating with database: failed to lookup address information: Name or service not known

backend | Starting dependencies..
backend | Starting repos..
backend | ** (EXIT from #PID<0.132.0>) an exception was raised:
backend | ** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom. This protocol is implemented for the following type(s): Cldr.Unit.Range, DBConnection.PrepareStream, DBConnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, Floki.HTMLTree, Flow, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, Indexer.BoundQueue, Jason.OrderedObject, List, Map, MapSet, Postgrex.Stream, Range, Stream, Timex.Interval

Type of the installation

Docker-compose

Type of the JSON RPC archive node

Geth

Type of the chain

No response

Link to the page

No response

Steps to reproduce

  1. clone blockscout from master branch
  2. change the env in common-blockscout as follow
    DATABASE_URL
    postgresql://postgres:@test-explorer.crnrz7sdkd7c.ap-southeast-1.rds.amazonaws.com:5432

ETHEREUM_JSONRPC_HTTP_URL=http://188.166.205.207

ETHEREUM_JSONRPC_TRACE_URL=http://188.166.205.207

  1. run the docker-compose

Backend version

latest

Frontend version

latest

Elixir & Erlang/OTP versions

Elixir 1.14.5 (compiled with Erlang/OTP 25)

Operating system

Linux

Additional information

No response

@vbaranov
Copy link
Member

vbaranov commented May 2, 2024

@SorrawitRUNGRUJEE you should put the db name at the end of the URI. So the full URI should look like your_uri + /${db_name}. E.g.

postgresql://postgres:***@test-explorer.crnrz7sdkd7c.ap-southeast-1.rds.amazonaws.com:5432/blockscout

@vbaranov vbaranov added waiting on feedback Waiting for original opener to respond if bug is fixed and removed triage labels May 2, 2024
@SorrawitRUNGRUJEE
Copy link
Author

SorrawitRUNGRUJEE commented May 3, 2024

@vbaranov Thank you for your advice

I've changed the database URL as you have suggested as follow

postgresql://postgres:************@test-explorer.crnrz7sdkd7c.ap-southeast-1.rds.amazonaws.com:5432/blockscout

but there are still error that is showing up

error_1

error_2

error_3

error_4

error_5

I have test the connection with DBeaver and pg_isready command line, both connection test were normal

@fslmultiservice22
Copy link

Cerco una collaborazione.

@yohanelly95
Copy link

yohanelly95 commented May 8, 2024

@SorrawitRUNGRUJEE you should put the db name at the end of the URI. So the full URI should look like your_uri + /${db_name}. E.g.

postgresql://postgres:***@test-explorer.crnrz7sdkd7c.ap-southeast-1.rds.amazonaws.com:5432/blockscout

hey @vbaranov, I am running postgres db on the same vm (not external) using the docker setup. Get the same error on backend:

Starting dependencies..
Starting repos..
** (EXIT from #PID<0.132.0>) an exception was raised:
    ** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom. This protocol is implemented for the following type(s): Cldr.Unit.Range, DBConnection.PrepareStream, DBConnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, Floki.HTMLTree, Flow, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, Indexer.BoundQueue, Jason.OrderedObject, List, Map, MapSet, Postgrex.Stream, Range, Stream, Timex.Interval
        (elixir 1.14.5) lib/enum.ex:1: Enumerable.impl_for!/1
        (elixir 1.14.5) lib/enum.ex:166: Enumerable.reduce/3
        (elixir 1.14.5) lib/enum.ex:4307: Enum.reverse/1
        (elixir 1.14.5) lib/keyword.ex:202: Keyword.new/2
        lib/explorer/repo/config_helper.ex:61: Explorer.Repo.ConfigHelper.extract_parameters/1
        lib/explorer/repo/config_helper.ex:26: Explorer.Repo.ConfigHelper.get_db_config/1
        lib/explorer/repo.ex:20: Explorer.Repo.init/2
        (ecto 3.11.2) lib/ecto/repo/supervisor.ex:25: Ecto.Repo.Supervisor.runtime_config/4

this is my DATABASE_URL =postgresql://blockscout:'password'@db:5432/blockscout
if I remove the quotes from 'password'. I get the following error:

        {"time":"2024-05-08T07:16:25.093Z","severity":"error","message":"Postgrex.Protocol (#PID<0.200.0>) failed to connect: ** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user \"blockscout\"","metadata":{"error":{"initial_call":null,"reason":"** (Postgrex.Error) FATAL 28P01 (invalid_password) password authentication failed for user \"blockscout\""}}}

using scram-sha-256

@yohanelly95
Copy link

Screenshot 2024-05-08 at 1 00 05 PM
attaching logs of stats. I have updated the same username and password on services/stats.yml and services/db.yml. Not sure what could be causing this issue. Tested connection to the db manually seems to work fine.

@vbaranov
Copy link
Member

@vbaranov Thank you for your advice

I've changed the database URL as you have suggested as follow

postgresql://postgres:************@test-explorer.crnrz7sdkd7c.ap-southeast-1.rds.amazonaws.com:5432/blockscout

but there are still error that is showing up

error_1

error_2

error_3

error_4

error_5

I have test the connection with DBeaver and pg_isready command line, both connection test were normal

@SorrawitRUNGRUJEE please check your DB URL to follow this regexp pattern (see comment #10047 (comment)). Most likely it doesn't follow this pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting on feedback Waiting for original opener to respond if bug is fixed
Projects
None yet
Development

No branches or pull requests

4 participants