ctx.userId undefined using REST API after upgrading to v3.12.0 (TS)

Hi guys!

Im working in a project with the version v3.11.0 and now Im needing to upgrade to 3.12.0 as the handleBeforeDeleteNotifications has a typo error in the TS Server Framework. (is missing a ‘s’. so is handleBeforeDeleteNotification)

After upgrading Ive started encountering a error when tring to fetch information via the REST API (rpc)
on a succesfully authenticated client which the ctx.userId is undefined.

Am I missing something or is this the intended behaviour?

  • Downgrading to the 3.11.0 makes the ctx.userId be filled again (works).
  • Upgrading to the 3.16.0 has the “same error”
  • The nakama-common is verified and matchs the version: v1.23.0 for the 3.12.0

Code on the front end to make a rpc request:

    data = await axios.post(
        headers: {
          Authorization: `Bearer ${token}`

Hello @igordias2

I believe the issue is that you’re setting both the http_key param (used for S2S calls) and the Authorization header in the request, for authenticated client requests you should only set the latter, this should resolve your issue.

I’d encourage you to upgrade to v3.16.0, we do our best to always keep the client APIs backwards compatible, but also check the changelog for any runtime API changes.


Hello @sesposito

You is right!
Removing the http_key from the url fixed the issue.

I was trying to upgrade to the latest version but everytime I was encountering this issue, so I sticked to the 3.11.0 that was the latest without the “error”.