-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
cannot unmarshal object into Go struct field InteractionCallback.state of type string #816
Comments
Thank you for reporting. |
Hi there - Im seeing the same error in prod this morning - I think Slack deployed a schema change within the last 24-48h that is breaking unmarshalling. This is happening on interaction callbacks (webhooks), the payload has changed and thus breaks Golang's quite strict JSON unmarshalling.
EDIT: Line 57 in 17a0fae
State is defined as string. I'm willing to push a fix, but such nested values are a real pain in Go. You need to decide whether it's worth the effort. For everyone looking for a quick fix, you just have to remove that line so that go doesn't try to unmarshal the EDIT 2: fixMap := make(map[string]json.RawMessage)
if err := json.Unmarshal(body, &fixMap); err != nil {
// handle error
}
delete(fixMap, "state")
fixedJSON, err := json.Marshal(fixMap)
if err != nil {
// handle err
}
// unmarshal fixedJSON into slack.InteractionCallback |
UPDATED: I'm sorry. I'm wrong about the type of interactions in Slack. Please ignore this comment X) |
Happening in prod for us as well. Can confirm that issue seems to be happening with block kit. |
Same issue for me, which force me to delete |
Thanks. |
I'm seeing this error for mobile users, but desktop users are currently unaffected |
The issue occurs on desktop as well. |
Just my 2 cents. This is definitely related to that update: https://api.slack.com/changelog/2020-09-full-state-on-view-submisson-and-block-actions The source of the problem that the library is using The possible solution from my point of view is to write a dynamic JSON unmarshaling and based on the type of submission treat Suggested earlier workaround with deletion of |
The type of state field in a Slack response to interactons now depends on the type of interaction. Specifically, the correspondence is as follows. - type: dialog_submisson -> state: string - type: block_actions -> state: dictionary array This commit is trying to handle these properly while maintaining backwards compatibility, so futureversions may change to a more approproate design. See Also: https://api.slack.com/changelog/2020-09-full-state-on-view-submisson-and-block-actions resolved: #816
The type of state field in a Slack response to interactons now depends on the type of interaction. Specifically, the correspondence is as follows. - type: dialog_submisson -> state: string - type: block_actions -> state: dictionary array This commit is trying to handle these properly while maintaining backwards compatibility, so futureversions may change to a more approproate design. See Also: https://api.slack.com/changelog/2020-09-full-state-on-view-submisson-and-block-actions resolved: #816
thanks @kanata2 for jumping on this, would be great if we could get a fix prioritized 🙏 |
I'll merge #820 to fix this issue. |
released v0.7.1 |
This should fix slack-go/slack#816
Following error occurred when handling block_actions callback.
The field is documented as dictionary of objects but the field of struct is string.
https://api.slack.com/reference/interaction-payloads/block-actions#reference-interactive-components-payloads__fields
The text was updated successfully, but these errors were encountered: