nakama-defold icon indicating copy to clipboard operation
nakama-defold copied to clipboard

"Received malformed payload" on match_data_send when upgrading to V3

Open mlvhub opened this issue 3 years ago • 11 comments
trafficstars

Hello, I followed the Defold+Nakama tutorial and created a similar game, then tried to upgrade the libraries to V3 and started getting errors on the server with "Received malformed payload".

I had some differences in code and setup so I continued my testing on the xoxo sample project branch and got the same results. Tried with multiple versions of the Nakama server and same thing.

Here's the decoded payload the server was complaining about:

{"match_data_send":{"op_code":1,"data":"{\"row\":1,\"col\":1}","match_id":"1325d106-4ea1-495f-be90-f0d33d73777c.nakama1"},"cid":"3"}

When going back to main and enabling debug level on the server but I could only find this message:

{"level":"debug","ts":"2022-10-26T19:35:35.207Z","caller":"server/pipeline.go:66","msg":"Received *rtapi.Envelope_MatchDataSend message","uid":"3a59222c-9749-4100-869f-0fe975a72be0","sid":"4cb4ce7b-5565-11ed-9018-7106fdcb5b46","cid":"3","message":{"MatchDataSend":{"match_id":"da0d6d5e-9665-4943-90af-785050561cdd.nakama1","op_code":1,"data":"eyJyb3ciOjEsImNvbCI6M30="}}}

There are some visible differences:

  • the key of the message: match_data_send vsMatchDataSend
  • data: it's a json string on V3 and it's base64 in the older version

Not sure if they should match one to one though, could be a red herring.

mlvhub avatar Oct 26 '22 19:10 mlvhub

Are you testing with the code on main or are you using the latest release?

The 3.0.3 version does not contain the fix for this issue

britzl avatar Oct 27 '22 08:10 britzl

I'm testing the latest release, that explains it then, thanks.

mlvhub avatar Oct 27 '22 09:10 mlvhub

I'm testing the latest release, that explains it then, thanks.

I've requested a new release which includes the fix.

https://github.com/heroiclabs/nakama-defold/pull/61

britzl avatar Oct 27 '22 12:10 britzl

That's great, thank you! I can confirm both my project and the example project work by using the master branch.

mlvhub avatar Oct 27 '22 12:10 mlvhub

I also had such a problem on the release, now I have a message sent on the master, but it does not go further

function M.sendMessage()
	nakama.sync(function()
		local data = json.encode({
			row = 11,
			col = 22,
		})
		--data=base64.encode(data)
		local op_code = 1
		local result = nakama_socket.match_data_send(socket, matchID, op_code, data)
		print("sended")
		if result.error then
			print(result.error.message)
			pprint(result)
		else
			print("ok!!!")
		end
	end)
end

print("sended") - is not running

ufgo avatar Oct 30 '22 06:10 ufgo

@ufgo which version of the Nakama client are you using? The fact that you don't see the print() indicates that something crashes in the coroutine, but for some reason the error is not shown (I'll look into this)-

britzl avatar Oct 30 '22 08:10 britzl

but for some reason the error is not shown (I'll look into this)

Ah, logging is silent by default. Enable logging by doing this:

local log = require "nakama.util.log"
log.print()

britzl avatar Oct 30 '22 08:10 britzl

i use log. Nothing print about my problem only log in docker: nakama-nakama-1 | {"level":"debug","ts":"2022-10-30T08:44:37.293Z","caller":"server/pipeline.go:65","msg":"Received *rtapi.Envelope_MatchDataSend message","uid":"f590a664-17b8-436c-8b57-037106dd7f93","sid":"e65afced-582e-11ed-9223-7106fdcb5b46","cid":"3","message":{"MatchDataSend":{"match_id":"3cc2b731-0cc6-496d-b957-6468de15b112.","op_code":1,"data":"eyJjb2wiOjIyLCJyb3ciOjExfQ=="}}}

ufgo avatar Oct 30 '22 08:10 ufgo

Can you share a minimal repro case so that I can take a look?

britzl avatar Nov 01 '22 10:11 britzl

Closing due to inactivity. I was also not able to repro any problem myself.

britzl avatar Nov 27 '23 09:11 britzl

I seem to have this problem as well. tho. I raised my own issue #80

goodiesohhi avatar Jul 11 '24 20:07 goodiesohhi