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

fix(koa->upload): fix the error that occurs when uploading files in the test server of Koa. #3698

Merged
merged 3 commits into from
Mar 28, 2024

Conversation

electroluxcode
Copy link

@electroluxcode electroluxcode commented Mar 27, 2024

问题好像出在koa对于form-data的上传数据结构变了,按照原来的代码在test-server下面启动并且上传文件会有如下报错,查看了一下目前的数据结构是 PersistentFile

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
    at ReadStream (node:internal/fs/streams:171:5)
    at new ReadStream (E:\myProject\vue-vben-admin\node_modules\.pnpm\graceful-fs@4.2.11\node_modules\graceful-fs\graceful-fs.js:299:28)
    at Object.createReadStream (E:\myProject\vue-vben-admin\node_modules\.pnpm\graceful-fs@4.2.11\node_modules\graceful-fs\graceful-fs.js:341:12)
    at fileFunc (E:\myProject\vue-vben-admin\apps\test-server\service\FileService.ts:13:23)
    at FileService.<anonymous> (E:\myProject\vue-vben-admin\apps\test-server\service\FileService.ts:49:7)
    at Generator.next (<anonymous>)
    at E:\myProject\vue-vben-admin\apps\test-server\service\FileService.ts:8:71
    at new Promise (<anonymous>)
    at __awaiter (E:\myProject\vue-vben-admin\apps\test-server\service\FileService.ts:4:12)
    at FileService.upload (E:\myProject\vue-vben-admin\apps\test-server\service\FileService.ts:22:16) {
  code: 'ERR_INVALID_ARG_TYPE'
}
[nodemon] app crashed - waiting for file changes before starting...

@likui628 likui628 merged commit 954f04f into vbenjs:main Mar 28, 2024
2 checks passed
@vbenjs vbenjs locked and limited conversation to collaborators Aug 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants