Skip to content

Bug: Can't send ArrayBuffer to Server Action despite react.dev saying so #27931

Closed as not planned
reactjs/react.dev
#6588
@alfonsusac

Description

@alfonsusac

Can't send ArrayBuffer to Server Action despite react.dev saying that you can. I'm not sure if this is an error or my part or the documentation. I retrieved the arrayBuffer from file of formData, then pass it through the parameter of the Server Action.

It seems like it doesn't get sent to the server because it can't be parsed due to ArrayBuffer being serializable but not iterable.

However this is somewhat confusing because you can attach File in FormData in the form of Blob and send it to the Server Action.

I understand that FormData is handled separately but I'm not sure I understand why it can't be done the same with ArrayBuffer.

I understand that I can just pass the FormData to send files but In my case I needed to transform the Files first before uploading and it ends up with a Blob.

React version:

Steps To Reproduce

  1. Create form, input, submit button, and also onSubmit function using Client Action
  2. Retrieve the arrayData from the formData then pass it to server action

Link to code example:

https://codesandbox.io/p/devbox/nextjs-arraybuffer-server-action-36gvxn

The current behavior

Throws client-side error

The expected behavior

ArrayBuffer gets sent to the server

The documentation:

image

Please let me know if I fail to understand the documentation or if it's something wrong in the documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: StaleAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions