NyllRE / nuxt-file-storage

Easy solution to store files in your nuxt apps. Be able to upload files from the frontend and recieve them from the backend to then save the files in your project.
https://nuxt.com/modules/nuxt-file-storage
MIT License
74 stars 10 forks source link

Cannot read properties of undefined (reading 'split') #7

Closed fir3bird closed 5 months ago

fir3bird commented 5 months ago

Hi, first: thanks for your work! :-)

Unfortunately I am facing an issue that is driving me crazy. I just started a naked nuxt project and wanted to play around with your library, but if I try to upload files I always get that error message on the server side:

[nuxt] [request error] [unhandled] [500] Cannot read properties of undefined (reading 'split')
  at parseDataUrl (******\node_modules\nuxt-file-storage\dist\runtime\server\utils\storage.mjs:26:20)
  at Object.handler (******\server\api\convert.ts:18:1)
  at async ******/node_modules/h3/dist/index.mjs:1962:19
  at async Object.callAsync (******/node_modules/unctx/dist/index.mjs:72:16)
  at async Server.toNodeHandle (******/node_modules/h3/dist/index.mjs:2249:7)

The strange thing is, that if I just do a console.log(file) right before the split function it shows the data that was transmitted correctly (as a string).

I would say "help me stackoverflow - you're my only hope" but this time even stackoverflow could not help me out of the garbage compactor.

fir3bird commented 5 months ago

OK, out of despair I completely restarted the project from zero and voila ... it now works - don't ask me why, must be a kind of black magic going on.

Thank you for this cool nuxt module once again and keep up the good work! :-)

NyllRE commented 5 months ago

@fir3bird You're welcome! I'm glad it works now, I suspect the issue has to do something with the title of the file since this might be where the split got confused. but if it happens again you are welcome to provide the details of the files you sent so I can get to fixing it asap