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

Error on .csv import: ENOENT: no such file or directory, open 'filename.csv' #8

Open
ardnaskela opened this issue Aug 4, 2022 · 1 comment

Comments

@ardnaskela
Copy link

ardnaskela commented Aug 4, 2022

Describe the bug
When importing a .csv file into a table, it fails with error 500, log message: Error on .csv import: ENOENT: no such file or directory, open 'filename.csv'. Export is working file. Tried on Windows 10 and Zorin OS 16.1 Lite.

Installed libraries and their versions
"@adminjs/express": "^5.0.0",
"@adminjs/import-export": "^2.0.0",
"@adminjs/nestjs": "^5.0.0",
"@adminjs/prisma": "^3.0.1"

To Reproduce
Follow the steps to create a basic NestJS/Prisma project: https://docs.nestjs.com/recipes/prisma
Install AdminJs and its dependencies for NestJS: https://docs.adminjs.co/module-@adminjs_nestjs.html
Install AdminJs and its dependencies for Prisma: https://docs.adminjs.co/module-@adminjs_prisma.html
Install AdminJs import-export: https://www.npmjs.com/package/@adminjs/import-export

Create the following AdminJs resource:
{
resource: {
model: dmmf.modelMap.Post,
client: prisma
},
features: [importExportFeature()],
}

Create a simple import.csv file and place it under /home/username/Documents on an Ubuntu-based Linux or under Documents on Windows 10:
title,content,published,author
Test Title,Test Content,true,

Launch AdminJs dashboard, Posts section and try to import the file. It gives the following error:
Error: ENOENT: no such file or directory, open 'filename.csv'

@ardnaskela
Copy link
Author

Hello,
from the looks of it, the bug should be fixed by the latest pull request ("update deps && fix pathname") that substitutes "await readFile(file.name)" with "await readFile(file.path)" in import.handler.ts so feel free to close the issue once it gets released.

Thanks.

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

1 participant