Open bnewland123 opened 6 months ago
Thanks for reporting @bnewland123. This is indeed a bug.
The issue is fixed in the v2 version of the Go SDK. https://github.com/clerk/clerk-sdk-go/tree/v2
We'll take a look into the problem and try to fix it for v1 as well.
@gkats I have the same problem with v2:
data, err := json.Marshal(publicMetadata)
if err != nil {
return err
}
rawMessage := json.RawMessage(data)
u, err := user.UpdateMetadata(
context.Background(),
userId,
&user.UpdateMetadataParams{
PublicMetadata: &rawMessage,
},
)
log.Printf("%v", string(u.Response.RawJSON))
return err
Same behavior as described earlier, succeeds but won't update. Switching to user.Update
works though.
Also, is v2 still in beta?
So it turns out to be a backend issue and X-Clerk-Sdk
header, I can repro with the following curl command:
curl -vvv -X PATCH 'https://api.clerk.com/v1/users/<user_id>/metadata' \
-H 'Authorization: Bearer <secret>' \
-H 'Content-Type: application/json' \
-H 'User-Agent: clerk/clerk-sdk-go@v2.0.0' \
-H 'X-Clerk-Sdk: go/v2.0.0' \
-d '{"public_metadata":{"test":"ok"}}'
This won't work. Remove X-Clerk-Sdk
header and it works.
Hello @reginaldl thank you for reporting. This was indeed a backend issue as you found out yourself.
The fix is now live.
Also, is v2 still in beta?
Yes, v2 is still in beta, at least officially. It's pretty stable though and we don't expect the APIs to change. The only thing that's missing is cookie-based authentication support.
Great! Thanks for the update. Let's close this ticket.
I'm facing the same issue in the v2 sdk. Any solutions?
I'm testing updating user metadata with the SDK. The call appears to succeed with no error, but the user is not updated. Is there something else that I'm missing here? I've also made sure the ID is the correct one.