heroiclabs / nakama

Distributed server for social and realtime games and apps.
https://heroiclabs.com
Apache License 2.0
8.9k stars 1.09k forks source link

[Bug] IAP Bug GoError: ON CONFLICT DO UPDATE command cannot affect row a second time #1194

Closed aaronren closed 6 months ago

aaronren commented 6 months ago

Description

It maybe the server bug. When I do the purchase verification, the server throw the following error: {"level":"error","ts":"2024-04-02T07:20:10.064Z","caller":"server/runtime_javascript_logger.go:94","msg":"purchase validation failed: GoError: error validating Apple receipt: ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time (SQLSTATE 21000)","rpc_id"...}

Both the 'receipt' and 'apple shared password' are no problem, because it can be verified through curl method. So I believe the problem is in the server and the error tips looks like it happen in the SQL processing.

Steps to Reproduce

  1. Ensure the 'apple shared password' is set in the nakama server config
  2. Send a purchase verification request to the nakama server with the Apple receipt
  3. Wait the 'nk.purchaseValidateApple' method to throw the error

Expected Result

No error is thrown and results are returned by server.

Actual Result

Error is thrown with '...ON CONFLICT DO UPDATE...' in logs.

Context

Client: Nakam Flutter SDK

Your Environment

linear[bot] commented 6 months ago

NK-538 [Bug] IAP Bug GoError: ON CONFLICT DO UPDATE command cannot affect row a second time

zyro commented 6 months ago

Already fixed in https://github.com/heroiclabs/nakama/commit/621c697e558d23528dcc1fde884f2d78163b08ba and will be part of the next release. 👍