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

Bug Report #2796

Closed
Shreyas2309 opened this issue Dec 27, 2024 · 7 comments
Closed

Bug Report #2796

Shreyas2309 opened this issue Dec 27, 2024 · 7 comments
Assignees
Labels
bug Something isn't working unapproved Unapproved for Pull Request

Comments

@Shreyas2309
Copy link

Describe the bug

When running the script to list sample data files, it fails with the following error:
Error listing sample data: Error: ENOENT: no such file or directory, scandir 'C:\C:\Shreyas\Project\talawa-api\sample_data'

The issue appears to stem from an incorrectly resolved file path, where an extra C:\ is added to the start of the path.

To Reproduce
Steps to reproduce the behavior:

  1. Clone the repository.
  2. Run the script using the appropriate command: npm run import:sample-data
  3. Observe the error message in the console.

Expected behavior
The script should successfully locate and list the .json files in the sample_data directory and display their document counts.

Actual behavior

The script fails to locate the directory due to an incorrectly resolved path:
C:\C:\Shreyas\Project\talawa-api\sample_data

Screenshots
image

Additional details

  1. The issue is likely caused by the resolution of import.meta.url to a filesystem path. This behavior is inconsistent across operating systems, particularly on Windows.

  2. The dirname calculation may need an update to handle the leading / or file:/// prefix correctly.

Potential internship candidates

Please read this if you are planning to apply for a Palisadoes Foundation internship

@Shreyas2309 Shreyas2309 added the bug Something isn't working label Dec 27, 2024
Copy link

Congratulations on making your first Issue! 🎊 If you haven't already, check out our Contributing Guidelines and Issue Reporting Guidelines to ensure that you are following our guidelines for contributing and making issues.

@github-actions github-actions bot added the unapproved Unapproved for Pull Request label Dec 27, 2024
@palisadoes
Copy link
Contributor

  1. Do you want to work on this?
  2. The solution must work for MacOS and Linux.
  3. Tests must be written so that the issue isn't repeated

@Shreyas2309
Copy link
Author

Yes, I’d like to work on this issue!

Could you please assign it to me? I’ll ensure the solution works across macOS, Linux, and Windows. Additionally, I’ll write tests to prevent this issue from recurring.

Looking forward to contributing!

@abhassen44
Copy link

same error i came across but i think its not error if run this
command inside wsl(linex)
or
linex (api-container) inside doker it will work

Screenshot 2024-12-27 211443

its showing deplicate because i already import it

@prayanshchh
Copy link
Contributor

Yes, I’d like to work on this issue!

Could you please assign it to me? I’ll ensure the solution works across macOS, Linux, and Windows. Additionally, I’ll write tests to prevent this issue from recurring.

Looking forward to contributing!

I don't get this error, everything works fine for me, are u working in develop-postgres branch..there is no sample_data folder in that branch

@Shreyas2309
Copy link
Author

This error occurs particularly on windows.

@palisadoes
Copy link
Contributor

palisadoes commented Dec 28, 2024

Thanks. Your solution mustn't break it's functionality with other operating systems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unapproved Unapproved for Pull Request
Projects
None yet
Development

No branches or pull requests

4 participants