Describe the bug
Cannot make login un teslamate after 1.19.3 upgrade
Unknown error
Expected behavior
How to reproduce it (as minimally and precisely as possible):
Relevant entries from the logs
16:46:28.292 [info] Version: 1.19.3
16:46:28.315 [info] Application teslamate exited: TeslaMate.Application.start(:normal, []) returned an error: shutdown: failed to start child: TeslaMate.Api
** (EXIT) an exception was raised:
** (RuntimeError) Found 2 token pairs!
Make sure that there is no more than ONE token pair in the table 'tokens'.
(teslamate 1.19.3) lib/teslamate/auth.ex:27: TeslaMate.Auth.get_tokens/0
(teslamate 1.19.3) lib/teslamate/api.ex:85: TeslaMate.Api.init/1
(stdlib 3.12.1) gen_server.erl:374: :gen_server.init_it/2
(stdlib 3.12.1) gen_server.erl:342: :gen_server.init_it/6
(stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
{"Kernel pid terminated",application_controller,"{application_start_failure,teslamate,{{shutdown,{failed_to_start_child,'Elixir.TeslaMate.Api',{#{'__exception__' => true,'__struct__' => 'Elixir.RuntimeError',message => <<\"Found 2 token pairs!\n\nMake sure that there is no more than ONE token pair in the table 'tokens'.\n\">>},[{'Elixir.TeslaMate.Auth',get_tokens,0,[{file,\"lib/teslamate/auth.ex\"},{line,27}]},{'Elixir.TeslaMate.Api',init,1,[{file,\"lib/teslamate/api.ex\"},{line,85}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,374}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,249}]}]}}},{'Elixir.TeslaMate.Application',start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,teslamate,{{shutdown,{failed_to_start_child,'Elixir.TeslaMate.Api',{#{'__exception__' => true,'__struct__' => 'Elixir.Runtime
Crash dump is being written to: erl_crash.dump...done
Screenshots
Data
Environment
I麓ve tried to make TRUNCATE tokens and DELETE FROM tokens, in the database, but still have the same issue in teslamate app logs. It said me have 2 pair of tokens in tokens database.
How can a reset tokens and any kind of authorization from the database or app?? I cannot enter into the web browser because of ths problem.
The problem start after 1.19.3 upgrade
Also I麓ve made a backup & restore of the DB but nothing happens
I was originally seeing the same error from issue 597, but updated my docker setup today and now get the same issue noted here.
database_1 | 2020-05-04 09:27:02.114 UTC [32] LOG: incomplete startup packet
teslamate_1 | 09:27:04.447 [info] == Running 20200502140646 TeslaMate.Repo.Migrations.DropUnusedIndexes.change/0 forward
teslamate_1 | 09:27:04.449 [info] drop index if exists positions_ll_to_earth_latitude__longitude_index
teslamate_1 | 09:27:04.462 [info] drop index if exists addresses_ll_to_earth_latitude__longitude_index
teslamate_1 | 09:27:04.469 [info] == Migrated 20200502140646 in 0.0s
teslamate_1 | 09:27:11.176 [info] Version: 1.19.3
teslamate_1 | 09:27:11.202 [info] Application teslamate exited: TeslaMate.Application.start(:normal, []) returned an error: shutdown: failed to start child: TeslaMate.Api
teslamate_1 | * (EXIT) an exception was raised:
teslamate_1 | * (RuntimeError) Found 2 token pairs!
teslamate_1 |
teslamate_1 | Make sure that there is no more than ONE token pair in the table 'tokens'.
teslamate_1 |
teslamate_1 | (teslamate 1.19.3) lib/teslamate/auth.ex:27: TeslaMate.Auth.get_tokens/0
teslamate_1 | (teslamate 1.19.3) lib/teslamate/api.ex:85: TeslaMate.Api.init/1
teslamate_1 | (stdlib 3.12.1) gen_server.erl:374: :gen_server.init_it/2
teslamate_1 | (stdlib 3.12.1) gen_server.erl:342: :gen_server.init_it/6
teslamate_1 | (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
teslamate_1 | {"Kernel pid terminated",application_controller,"{application_start_failure,teslamate,{{shutdown,{failed_to_start_child,'Elixir.TeslaMate.Api',{#{'__exception__' => true,'__struct__' => 'Elixir.RuntimeError',message => <<\"Found 2 token pairs!\n\nMake sure that there is no more than ONE token pair in the table 'tokens'.\n\">>},[{'Elixir.TeslaMate.Auth',get_tokens,0,[{file,\"lib/teslamate/auth.ex\"},{line,27}]},{'Elixir.TeslaMate.Api',init,1,[{file,\"lib/teslamate/api.ex\"},{line,85}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,374}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,342}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,249}]}]}}},{'Elixir.TeslaMate.Application',start,[normal,[]]}}}"}
teslamate_1 | Kernel pid terminated (application_controller) ({application_start_failure,teslamate,{{shutdown,{failed_to_start_child,'Elixir.TeslaMate.Api',{#{'__exception__' => true,'__struct__' => 'Elixir.Runtime
teslamate_1 |
teslamate_1 | Crash dump is being written to: erl_crash.dump...done
database_1 | 2020-05-04 09:27:14.766 UTC [45] LOG: incomplete startup packet
teslamate_teslamate_1 exited with code 1
Hello finally I solved With command **
DELETE FROM tokens;
**
I ran the following Steps to address the error message
Execute commands to Database :
docker-compose exec database psql -U teslamate -d teslamate
To see what is in the tokens table :
SELECT * FROM tokens;
To delete a specific row :
DELETE FROM tokens WHERE id = 1;
Confirm Delete :
SELECT * FROM tokens;
Reboot your Docker Container :
docker-compose restart