Parse error: first path segment in URL cannot contain colon

Anyone has an idea what I might be doing wrong? After running “docker-compose up”, I get the following:

stack_1      |   INFO Setting up Identity Server              
stack_1      | error:cmd/internal/shared:initialize_identity_server (could not initialize Identity Server)
stack_1      | --- parse "postgres://root@cockroach:26257/ttn_lorawan?sslmode=disable": first path segment in URL cannot contain colon
ttn_stack_1 exited with code 255

I went ahead and edited “postgres://root@cockroach:26257/ttn_lorawan?sslmode=disable” in docker-compose.yml and removed the first colon: “postgres//root@cockroach:26257/ttn_lorawan?sslmode=disable”

Although that error doesn’t make sense to me, I now got a different error after removing the colons:

stack_1      |   INFO Setting up Identity Server              
stack_1      | error:cmd/internal/shared:initialize_identity_server (could not initialize Identity Server)
stack_1      | --- dial tcp: lookup postgres on 127.0.0.11:53: server misbehaving
ttn_stack_1 exited with code 255

I am running everything in an Ubuntu Bionic VM on localhost or 127.0.0.1

Thanks in advance!

I also saw this error when removing the colons only as above:

stack_1      |   INFO Setting up Identity Server              
stack_1      | error:cmd/internal/shared:initialize_identity_server (could not initialize Identity Server)
stack_1      | --- dial tcp 127.0.0.1:5432: connect: connection refused

As far as I understand, port 5432 should only be available if I use the Postgres DB instead of CockroachDB. I am only using CockroachDB per the default configuration so I don’t understand why it’s trying to connect to port 5432. Maybe because CockroachDB URL became wrong after I removed the colons so now it’s falling back to postgres?

Hello Zaher

I see in your post you mentiond that yo use Localhost 127.0.0.1 but in the screen you send you use “lookup postgres on 127.0.0.11”

I hope it is this typo for you :slight_smile:

Hi @jwijngaard - thanks for replying! Actually, the error you mentioned I have seen only once when I accidentally removed both cockroach and postgres from the yml file, which is still weird and sounds to me like a bug in the container. However, if you look at the other two errors I listed, they correctly mention the IP address 127.0.0.1

So unfortunately the problem I mentioned earlier persist :frowning_face:

I switched from using CockroachDB to using Postgres instead, and now I am seeing a different error:

stack_1      |   INFO Setting up Identity Server              
stack_1      | error:cmd/internal/shared:initialize_identity_server (could not initialize Identity Server)
stack_1      | --- error:pkg/identityserver:db_needs_migration (the database needs to be migrated)
stack_1      | --- error:pkg/identityserver/store:database_table (database table `accounts` does not exist)
stack_1      |     table=accounts
ttn_stack_1 exited with code 255

I also noticed this in the logs which could be relevant:

postgres_1   | 2020-01-10 01:22:10.011 UTC [23] LOG:  database system was shut down at 2020-01-09 23:24:35 UTC
postgres_1   | 2020-01-10 01:22:10.024 UTC [1] LOG:  database system is ready to accept connections

Hi Zaher,

I got your same error. I solved following instructions on https://thethingsstack.io/v3.3.2/guides/getting-started/running-the-stack/
I initialized tables in cockroach, created admin user and so on…
In this way web server is up and running.

1 Like

@carlomissaglia, thanks very much for helping! I ran docker-compose pull and it seems to have worked just fine:

Pulling cockroach ... done
Pulling redis     ... done
Pulling stack     ... done

However, after I run: docker-compose run --rm stack is-db init
I still see the following error:

Starting ttn-stack_redis_1 ... done
Starting ttn-stack_cockroach_1 ... done
  INFO Connecting to Identity Server database...
parse "postgres://root@cockroach:26257/ttn_lorawan?sslmode=disable": first path segment in URL cannot contain colon

Hi zaher,

You have to delete “ at the begin and at the end.
Try in this way. postgres://root@cockroach:26257/ttn_lorawan?sslmode=disable
BR.

1 Like

That was exactly my issue! Thanks a lot @carlomissaglia!
I was able to run without errors unitl docker-compose up, I got the following error:

stack_1      | --- error:pkg/gatewayserver:listen_frontend (failed to start frontend listener `MQTT/tls` on address `:8882`)
stack_1      |     address=:8882
stack_1      |     protocol=MQTT/tls
stack_1      | --- open cert.pem: no such file or directory

I know the cert.pem file exists in the same directory where I have docker-compose.yml and run the docker-compose up command from. I also made sure I have run chown 866:866 ./cert.pem. Even when I changed it to an absolute file path in the docker-compose.yml, I still got the same error. What could I be missing here?

This topic was automatically closed after 30 days. New replies are no longer allowed.