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

error decoding login connResp: json: cannot unmarshal array into Go value of type map[string]interface {} #633

Open
castillofranciscodaniel opened this issue Nov 3, 2021 · 5 comments

Comments

@castillofranciscodaniel
Copy link

Hi! We were having a problem when the function Login() try to unmarshall the response from loginChan. Unmarshall is expecting a []map[string]interface{} but it is receiving a map[string]interface{}

`case r = <-loginChan:
case <-time.After(wac.msgTimeout):
return session, fmt.Errorf("login connection timed out")
}

var resp map[string]interface{}
if err = json.Unmarshal([]byte(r), &resp); err != nil {
	return session, fmt.Errorf("error decoding login resp: %v\n", err)
}`

Log from server:
goroutine 11 [running]:
api-channel-whatsapp/pkg/messaging.login(0xc000198100, 0x1, 0x3)
/go/src/app/pkg/messaging/whatsappImpl.go:553 +0x70e
api-channel-whatsapp/pkg/messaging.WhatsappSession()
/go/src/app/pkg/messaging/whatsappImpl.go:395 +0x1c2

@fchattigo
Copy link

fchattigo commented Nov 3, 2021

I think, that is not the place where unmarshall can not work. I was looking and i think the problem is in Restore(), in some
of the unmarshal

2021/11/03 17:05:38 [SUCCESS LOADIN CONFIG]
2021/11/03 17:05:39 [2 2121 6]
2021/11/03 17:05:39 [readSession][INIT]
2021/11/03 17:05:39 [DownloadSession][INIT]
2021/11/03 17:05:39 [DownloadSession][END]
2021/11/03 17:05:39 [readSession][END]
2021/11/03 17:05:39 [Login][ERROR] error decoding login connResp: json: cannot unmarshal array into Go value of type map[string]interface {}
panic: error decoding login connResp: json: cannot unmarshal array into Go value of type map[string]interface {}

@apariciojuan
Copy link

Try this.

wac.SetClientVersion(3, 2123, 7)

@manishswami
Copy link

manishswami commented Nov 4, 2021

Working..

wac.SetClientVersion(2, 2142, 12)

@fchattigo
Copy link

Hi! thanks for answer me.Yes, it is working!

@gurlivleenkainth2000
Copy link

gurlivleenkainth2000 commented Sep 2, 2022

Try this.

wac.SetClientVersion(3, 2123, 7)

Thank You, It is working for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants