go-tarantool icon indicating copy to clipboard operation
go-tarantool copied to clipboard

failed to authenticate: User not found or supplied credentials are invalid

Open ahmadhabibi14 opened this issue 1 month ago • 3 comments

I'm pretty sure that my config was alreary right, I've tried to connect with CLI and it works, but it why it doesn't work via Go ?

Connect with Go

package tt_custom

import (
	"context"
	"testing"
	"time"

	"github.com/tarantool/go-tarantool/v3"
)

func TestConnectTarantool(t *testing.T) {
	dialer := tarantool.NetDialer{
		Address:  "127.0.0.1:3304",
		User:     "tacticdT",
		Password: "tacticdPT",
	}
	opts := tarantool.Opts{
		Timeout: 8 * time.Second,
	}

	conn, err := tarantool.Connect(context.Background(), dialer, opts)
	if err != nil {
		t.Error(err, "Connection refused")
		return
	}

	data, err := conn.Do(
		tarantool.NewInsertRequest(999).Tuple([]interface{}{99999, "BB"})).Get()
	if err != nil {
		t.Error(err, "failed to insert data")
	} else {
		t.Log(data, "data inserted")
	}
}

Test result:

❯ go test -v ./tt_custom                                                                                                                                                                                                          ─╯
=== RUN   TestConnectTarantool
    tarantool_adapter_test.go:23: failed to authenticate: User not found or supplied credentials are invalid (ClientError, code 0x2f), see ./src/box/authentication.c line 117 Connection refused
--- FAIL: TestConnectTarantool (0.00s)
FAIL
FAIL    tacticduar/tt_custom    0.007s
FAIL

Docker compose config:

services:
  tarantool:
    image: tarantool/tarantool:3.5.0
    container_name: tacticduar-tarantool
    environment:
      TARANTOOL_USER_NAME: "tacticdT"
      TARANTOOL_USER_PASSWORD: "tacticdPT"
      TT_READAHEAD: '1632000' # 10x
      TT_VINYL_MEMORY: '268435456' # 20x
      TT_VINYL_CACHE: '2684354560' # 20x
      TT_NET_MSG_MAX: '76800' # 100x
      TT_MEMTX_MEMORY: '268435456' # 1x
      TT_VINYL_PAGE_SIZE: '8192' # 1x
      TT_FORCE_RECOVERY: 'true'
    volumes:
      - ./_tmpdb/var_lib_tarantool:/var/lib/tarantool
    ports:
      - "3304:3301"

Connect with CLI

❯ docker exec -it tacticduar-tarantool console tacticdT:[email protected]:3304                                                                 ─╯
   • Connecting to the instance...
   • Connected to /var/run/tarantool/sys_env/default/instance-001/tarantool.control

/var/run/tarantool/sys_env/default/instance-001/tarantool.control> 

ahmadhabibi14 avatar Oct 28 '25 16:10 ahmadhabibi14

tried with ./opt__tarantool__app__config.yaml

credentials:
  users:
    tacticdT:
      roles: [ super ]
      password: 'tacticdPT'

iproto:
  listen:
    - uri: 0.0.0.0:3301

groups:
  group-001:
    replicasets:
      replicaset-001:
        instances:
          instance-001: { }

also didn't work

services:
  tarantool:
    image: tarantool/tarantool:3.5.0
    container_name: tacticduar-tarantool
    environment:
      TT_APP_NAME: default
      TT_INSTANCE_NAME: instance-001
    volumes:
      - ./_tmpdb/var_lib_tarantool:/var/lib/tarantool
      - ./opt__tarantool__app__config.yaml:/opt/tarantool/app/config.yaml
    ports:
      - "3304:3301"
docker-compose.yaml 

no user created

docker exec -it tacticduar-tarantool console
   • Connecting to the instance...
   • Connected to /var/run/tarantool/sys_env/default/instance-001/tarantool.control

/var/run/tarantool/sys_env/default/instance-001/tarantool.control> box.space._user:select()
---
- - [0, 1, 'guest', 'user', {'chap-sha1': 'vhvewKp0tNyweZQ+cFKAlsyphfg='}, [], 0]
  - [1, 1, 'admin', 'user', {}, [], 0]
  - [2, 1, 'public', 'role', {}, [], 0]
  - [3, 1, 'replication', 'role', {}, [], 0]
  - [31, 1, 'super', 'role', {}, [], 0]
...

config got in for sure

 docker exec -it tacticduar-tarantool bash
root@eed63f13f030:/opt/tarantool# cat app/config.yaml
credentials:
  users:
    tacticdT:
      roles: [ super ]
      password: 'tacticdPT'

iproto:
  listen:
    - uri: 0.0.0.0:3301

groups:
  group-001:
    replicasets:
      replicaset-001:
        instances:
          instance-001: { }

kokizzu avatar Oct 28 '25 17:10 kokizzu

I've tried to connect with CLI and it works

Have you tried connecting using TT CLI? If so, the TT CLI tool used go-tarantool/v2 inside. So it should work.

oleg-jukovec avatar Oct 29 '25 07:10 oleg-jukovec

no user created

This looks like a Tarantool issue, please ask your question here: https://github.com/tarantool/tarantool/issues/

oleg-jukovec avatar Oct 29 '25 07:10 oleg-jukovec