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]: Error import MongoDB #4994

Closed
albertorizzi opened this issue Jan 28, 2025 · 6 comments · Fixed by #4941
Closed

[Bug]: Error import MongoDB #4994

albertorizzi opened this issue Jan 28, 2025 · 6 comments · Fixed by #4941

Comments

@albertorizzi
Copy link
Contributor

Error Message and Logs

This error appears when I try to import a backup of MongoDB Coolify Instance.

2025-01-28T07:51:05.586+0000	Failed: file /tmp/restore_xc4s4s8wswgcwg0o84kgkcg4 does not have .bson extension
2025-01-28T07:51:05.587+0000	0 document(s) restored successfully. 0 document(s) failed to restore.

Image

Steps to Reproduce

  1. Go to the MongoDB Instance, click on backup now and download.
  2. Import the backup in the Import Backup tab.

Example Repository URL

No response

Coolify Version

v4.0.0-beta.389

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

No response

Additional Information

No response

@albertorizzi albertorizzi added 🐛 Bug Reported issues that need to be reproduced by the team. 🔍 Triage Issues that need assessment and prioritization. labels Jan 28, 2025
@albertorizzi albertorizzi changed the title [Bug]: Error import MongoDb [Bug]: Error import MongoDB Jan 28, 2025
@LaurenceJJones
Copy link
Contributor

LaurenceJJones commented Jan 28, 2025

Just cause did some debugging mongorestore does a sanity check when importing a backup, one of said checks is that the file has to have a .bson or .bson.gz (and some others but the ext cannot be exmpty) file extension. If the file does not have this extension then it bails.

$backupFileName = '/tmp/restore_'.$this->resource->uuid;

Since we save the file as restore_<uuid> it does not have a file extension so fails said checks.

https://github.com/mongodb/mongo-tools/blob/742d21bdc2f912c91a5179c415c2322b940fdeaf/mongorestore/filepath.go#L715-L717

@albertorizzi
Copy link
Contributor Author

Just cause did some debugging mongorestore does a sanity check when importing a backup, one of said checks is that the file has to have a .bson or .bson.gz (and some others but the ext cannot be exmpty) file extension. If the file does not have this extension then it bails.

Thanks for your answer! I changed the extension, but it still doesn't work.
Does it work for you? @LaurenceJJones

@LaurenceJJones
Copy link
Contributor

LaurenceJJones commented Jan 28, 2025

Just cause did some debugging mongorestore does a sanity check when importing a backup, one of said checks is that the file has to have a .bson or .bson.gz (and some others but the ext cannot be exmpty) file extension. If the file does not have this extension then it bails.

Thanks for your answer! I changed the extension, but it still doesn't work. Does it work for you? @LaurenceJJones

No the issue is the copy code, it doesnt matter what extension you use when uploading it always removes it....

IMO the code should using /tmp/restore_<uuid>.<uploadedFileExt> or /tmp/restore_<uuid>.<customLocationFileExt> always as other import utilities may use the file extension to optimize the process EG .gz to denote a compressed file.

@albertorizzi
Copy link
Contributor Author

albertorizzi commented Jan 28, 2025

Thanks for your help! We need to wait for @peaklabs-dev or @andrasbacsai to address the issue.

Is it possible to include the fix in v. 390 (#4941)?

@andrasbacsai
Copy link
Member

I found the bug. Fixing in v390.

@albertorizzi
Copy link
Contributor Author

I found the bug. Fixing in v390.

Thanks a lot Andras!

@github-actions github-actions bot removed 🐛 Bug Reported issues that need to be reproduced by the team. 🔍 Triage Issues that need assessment and prioritization. labels Jan 28, 2025
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

Successfully merging a pull request may close this issue.

3 participants