question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Production - "File Not Found :("

See original GitHub issue

Hey. I’m having an issue with Meteor-Files on production. When I try to reach file locally then there is no problem, file is available via link http://localhost/cdn/storage/Documents/3JsddXYv76Z9L9uaw/original/3JsddXYv76Z9L9uaw.jpg (generated by ‘link’ helper). When I deploy my application to custom server and run in it production mode then I am not able to reach files - I get error File Not Found :( (I use link helper on production as well and get same link just with localhost replaced by IP address).

My setup: Local OS: Mac OS 10.14 Production OS: Ubuntu 14.04 Meteor: METEOR@1.5.1 Meteor-Files: ostrio:files@1.8.2

Here is how I initialize collection:

const Documents = new FilesCollection({
  collectionName: 'Documents',
  allowClientCode: false,
  storagePath: function() {
    return Meteor.isProduction ? '/home/documents' : `${process.env.PWD}/assets`;
  },
  permissions: 0777,
  parentDirPermissions: 0777,
  onBeforeUpload: function (file) {
    ...
  }
});

Collection is of course published & subscribed. There is no problem with uploading files (file is uploaded correctly to destination folder) and is inserted to db collection on both local and production.

With thanks to debug mode I have server logs:

  1. When uploading file (everything seems to work fine here):
[FilesCollection] [File Start Method] file.jpg - JDY5FrvLFHwm9NSAh
[FilesCollection] [Upload] [DDP Start Method] Got #-1/1 chunks, dst: file.jpg
[FilesCollection] [Upload] [DDP] Got #1/1 chunks, dst: file.jpg
[FilesCollection] [Upload] [DDP] Got #-1/1 chunks, dst: file.jpg
[FilesCollection] [Upload] [finish(ing)Upload] -> /home/documents/JDY5FrvLFHwm9NSAh.jpg
[FilesCollection] [Upload] [finish(ed)Upload] -> /home/documents/JDY5FrvLFHwm9NSAh.jpg
[FilesCollection] [_preCollectionCursor.observe] [changed]: JDY5FrvLFHwm9NSAh
[FilesCollection] [_preCollectionCursor.observe] [removed]: JDY5FrvLFHwm9NSAh
  1. When trying to access file in application:
[FilesCollection] [download(/cdn/storage/Documents/JDY5FrvLFHwm9NSAh/original/JDY5FrvLFHwm9NSAh.jpg)] [_404] File not found

3 Quite often I get such log on server (both local and production) when running in debug mode:

[FilesCollection] [find(undefined, undefined)]

Folder /home/documents on production server has 777 rights set.

Due to that issue I can’t open any uploaded files on production as they return 404. I looked for other issues which seemed to be related but none of answers helped. Hope there is some way to fix that issue.

Thanks for your time and help in advance!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bartoszglowcommented, Jul 8, 2019

Hey, issue was solved by updating meteor and moving to docker deployment.

0reactions
dr-dimitrucommented, Jul 8, 2019

@joinee thank you for update on than one. I guess it was updating Meteor-Files package itself along with meteor (we improve our packages constantly)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Production - "File Not Found :(" · Issue #666 - GitHub
Hey. I'm having an issue with Meteor-Files on production. When I try to reach file locally then there is no problem, file is...
Read more >
Static file not found in Django production - Stack Overflow
My settings.py is as below and I have pointed my STATIC_ROOT to productionStatic folder. This is the folder where collectstatic has transferred ...
Read more >
Deployment - Angular
When the base tag is mis-configured, the application fails to load and the browser console displays 404 - Not Found errors for the...
Read more >
Vite CSS file not found in production - Cached Manifest?
I have just started using Vite on a recent project. I am building the CSS files locally and pushing them to git. Envoyer...
Read more >
module-not-found - Next.js
The module you're trying to import is in a different directory. Make sure that the path you're importing refers to the right directory...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found