nuxt-hub / core

Build full-stack applications with Nuxt on CloudFlare, with zero configuration.
https://hub.nuxt.com
Apache License 2.0
993 stars 57 forks source link

handlemultipartupload seems to no work #314

Closed germsb closed 1 month ago

germsb commented 1 month ago

Describe the bug handlemultipartupload systematically returns an error

https://localhost:3000/api/files/multipart/create/google-chrome-stable_current_amd64.deb 400 (Bad Request)
Uncaught (in promise) FetchError: [POST] "/api/files/multipart/create/google-chrome-stable_current_amd64.deb": 400 Bad Request
    at async $fetch2 (ofetch.4747642d.mjs?v=d7c0ec42:304:15)

Steps to reproduce Example in the doc or in the playground

PS: I use remote storage for dev, and everything works normally apart from this

atinux commented 1 month ago

I cannot reproduce your issue, tested on:

https://github.com/user-attachments/assets/99b8332a-013f-45cf-b352-1392935e38c2

germsb commented 1 month ago

I copied and pasted the different APIs as well as the content of the blob.vue page into my project, and I’m still get the same error. I admit I don’t understand.

Capture d’écran du 2024-10-11 20-21-13

Capture d’écran du 2024-10-11 20-22-20

Capture vidéo du 2024-10-11 20-41-37.webm

chrome devtool response

{
    "url": "/api/blob/multipart/create/GX010179.MP4",
    "statusCode": 400,
    "statusMessage": "",
    "message": "[POST] \"https://XXXXXXXXXXXXX.pages.dev/api/_hub/blob/multipart/GX010179.MP4\": 404 Page not found: /api/_hub/blob/multipart/GX010179.MP4",
    "stack": "<pre><span class=\"stack internal\">at createError (./node_modules/h3/dist/index.mjs:78:15)</span>\n<span class=\"stack internal\">at createHandler (./node_modules/@nuxthub/core/dist/runtime/blob/server/utils/blob.js:302:13)</span>\n<span class=\"stack internal\">at process.processTicksAndRejections (node:internal/process/task_queues:95:5)</span>\n<span class=\"stack internal\">at handler (./node_modules/@nuxthub/core/dist/runtime/blob/server/utils/blob.js:369:15)</span>\n<span class=\"stack internal\">at Object.handleMultipartUpload (./node_modules/@nuxthub/core/dist/runtime/blob/server/utils/blob.js:393:20)</span>\n<span class=\"stack\">at Object.handler (./server/api/blob/multipart/[action]/[...pathname].ts:2:1)</span>\n<span class=\"stack internal\">at async ./node_modules/h3/dist/index.mjs:1978:19</span>\n<span class=\"stack internal\">at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)</span>\n<span class=\"stack internal\">at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)</span>\n<span class=\"stack internal\">at async Server.toNodeHandle (./node_modules/h3/dist/index.mjs:2270:7)</span></pre>"
}

EDIT: After some investigation,

atinux commented 1 month ago

Thank you so much for being so helpful on it, I can reproduce, will fix it quickly! Sorry about this!

atinux commented 1 month ago

Hey @germsb

Could you try with:

pnpm add https://pkg.pr.new/nuxt-hub/core/@nuxthub/core@318

Then try again with nuxi dev --remote and confirm me that it fixes it? (no need to deploy anything normally)

germsb commented 1 month ago

Hello @atinux Everything works perfectly now with this version @nuxthub/core@0.7.28-20241014-100530-cb2eb4e Thank you very much for your responsiveness.

Capture vidéo du 2024-10-14 12-23-04.webm

atinux commented 1 month ago

Awesome ❤️

zaosoula commented 1 month ago

Hi @atinux, while using "@nuxthub/core": "^0.7.33" I got the exact same problem

zaosoula commented 1 month ago

Without enabling remote, the error message is more complete :

{
    "url": "/api/files/multipart/upload/Screenshot%202024-10-17%20at%2016.18.24.png?uploadId=tsRqrV0JSsAz-KU9YJsFbkkxmrrDF7fZa1MbfzYYw4ejgq8ynzD2oh0GaL3YCbacxZ1Q6fRXMMe7IE1rn9-h4PVdBqDQT2L6WgMyodS62Pg5TMulzscZJCTfu9N2Qf2Ea94X7Kcvng1LECbdZp0lPJZv0fAFc3WxOpVFVCTcXr0&partNumber=1",
    "statusCode": 400,
    "statusMessage": "",
    "message": "uploadPart: The specified multipart upload does not exist. (10024)",
    "stack": "<pre><span class=\"stack internal\">at createError (./node_modules/h3/dist/index.mjs:78:15)</span>\n<span class=\"stack internal\">at uploadHandler (./node_modules/@nuxthub/core/dist/runtime/blob/server/utils/blob.js:345:13)</span>\n<span class=\"stack internal\">at process.processTicksAndRejections (node:internal/process/task_queues:95:5)</span>\n<span class=\"stack internal\">at handler (./node_modules/@nuxthub/core/dist/runtime/blob/server/utils/blob.js:397:15)</span>\n<span class=\"stack internal\">at Object.handleMultipartUpload (./node_modules/@nuxthub/core/dist/runtime/blob/server/utils/blob.js:415:20)</span>\n<span class=\"stack\">at Object.handler (./server/api/files/multipart/[action]/[...pathname].ts:2:1)</span>\n<span class=\"stack internal\">at async ./node_modules/h3/dist/index.mjs:1975:19</span>\n<span class=\"stack internal\">at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)</span>\n<span class=\"stack internal\">at async Object.callAsync (./node_modules/unctx/dist/index.mjs:72:16)</span>\n<span class=\"stack internal\">at async Server.toNodeHandle (./node_modules/h3/dist/index.mjs:2266:7)</span></pre>"
}

Screenshot 2024-10-18 at 12 04 47

zaosoula commented 1 month ago

🙌 The error only appends when the filename contains spaces (ex: Screenshot 2024-10-15 at 16.05.37.png)

atinux commented 1 month ago

Could you test with 0.7.34 please?

zaosoula commented 1 month ago

@atinux Problem solved thank you!