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

Large file upload to local KV results in error #327

Open
radu-matei opened this issue Feb 4, 2025 · 3 comments
Open

Large file upload to local KV results in error #327

radu-matei opened this issue Feb 4, 2025 · 3 comments

Comments

@radu-matei
Copy link
Member

radu-matei commented Feb 4, 2025

2025-02-04T21:21:32.898242Z ERROR spin_trigger_http::server: Error processing request: guest invocation failed

Caused by:
    0: error while executing at wasm backtrace:
           0: 0x596dd9 - <unknown>!<wasm function 10144>
           1: 0x235f7e - <unknown>!<wasm function 5138>
           2: 0x263ede - <unknown>!<wasm function 5403>
           3: 0x264b11 - <unknown>!<wasm function 5406>
           4: 0x26532f - <unknown>!<wasm function 5409>
           5: 0x369b39 - <unknown>!<wasm function 7217>
           6: 0x268ad1 - <unknown>!<wasm function 5437>
           7: 0x25b78b - <unknown>!<wasm function 5402>
           8: 0x2556e1 - <unknown>!<wasm function 5400>
           9: 0x263da4 - <unknown>!<wasm function 5403>
          10: 0x264b11 - <unknown>!<wasm function 5406>
          11: 0x390e69 - <unknown>!<wasm function 7547>
          12: 0x2d25d6 - <unknown>!<wasm function 6247>
          13: 0x351d8a - <unknown>!<wasm function 7123>
          14: 0x263ede - <unknown>!<wasm function 5403>
          15: 0x264b11 - <unknown>!<wasm function 5406>
          16: 0x2e552c - <unknown>!<wasm function 6399>
          17: 0x32209e - <unknown>!<wasm function 6797>
          18: 0x25001 - <unknown>!<wasm function 164>
          19: 0x70f0a - <unknown>!<wasm function 714>
          20: 0x2a65c - <unknown>!<wasm function 259>
    1: wasm trap: wasm `unreachable` instruction executed

Simple repro:

    .post('/api/uploads/:id', async (req) => {
        let { id } = req.params;
        let store = Kv.openDefault();
        try {

            const bodyBytes = new Uint8Array(await req.arrayBuffer());
            console.log(`[api]: Starting upload for ${id} with size ${bodyBytes.byteLength}`)
            store.set(`zip-${id}`, bodyBytes);
            return new Response('OK', { status: 200 })
        } catch (e: any) {
            console.error(`[api]: Error uploading for ${id}: ${e.payload}`)
            return error(500, `Internal server error.`)
        }

    })
@radu-matei radu-matei changed the title await req.arrayBuffer() results in error Large file upload to local KV results in error Feb 4, 2025
@radu-matei
Copy link
Member Author

This will be fixed by the upcoming release based on bytecodealliance/ComponentizeJS#184

@radu-matei
Copy link
Member Author

ComponentizeJS PR has been merged 🎉

Once we have a release, I would like to have a patch release that includes this and #326.

What do you think?

@ThorstenHans
Copy link
Contributor

Awesome, cutting a release including this and #326 would be awesome. (cc @karthik2804 for viz)

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