Skip to content
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

Failed to execute 'structuredClone' on prepared vector #25

Open
rajsite opened this issue Feb 21, 2024 · 3 comments
Open

Failed to execute 'structuredClone' on prepared vector #25

rajsite opened this issue Feb 21, 2024 · 3 comments

Comments

@rajsite
Copy link

rajsite commented Feb 21, 2024

Trying to use the preparePostMessage and rehydrateVector helpers on the README example I get the error message:

Uncaught DOMException: Failed to execute 'structuredClone' on 'Window': (index) => isChunkedValid(unchunkedData, index) could not be cloned.

See stackblitz example: https://stackblitz.com/edit/geoarrow-readme-worker-example?file=src%2Fmain.ts&terminal=dev
And open devtools to see the error.

npm list:

+-- @esbuild/linux-x64@0.19.12 extraneous
+-- @geoarrow/geoarrow-js@0.3.0
+-- @rollup/rollup-linux-x64-gnu@4.12.0 extraneous
+-- @rollup/rollup-linux-x64-musl@4.12.0 extraneous
+-- apache-arrow@15.0.0
+-- typescript@5.3.3
`-- vite@5.1.3
@rajsite
Copy link
Author

rajsite commented Feb 21, 2024

Looks like the tests only cover Data and not Vector, maybe an issue has been introduced?

It does look like preparePostMessage(Data) and rehydrateData are working but the vector example shown in the README does not seem to.

@kylebarron
Copy link
Member

I don't think I ever tested it on Vector, despite implementing preparePostMessage on Vector and rehydrateVector.

Presumably the issue is that a few methods are assigned as attributes with function definitions https://github.com/apache/arrow/blob/6a22a1dee78b0f7daa7e4d8793d663e29a5712a6/js/src/vector.ts#L81-L84

@kylebarron
Copy link
Member

I figure that the best solution is to create a new object with only known properties https://github.com/apache/arrow/blob/6a22a1dee78b0f7daa7e4d8793d663e29a5712a6/js/src/vector.ts#L93-L97.

Are you interested in making a PR? It's probably just a couple lines here

return [vector, transferArrayBuffers];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants