tomitrescak / meteor-uploads

MIT License
295 stars 41 forks source link

net::ERR_CONNECTION_REFUSED #188

Closed appjitsu closed 8 years ago

appjitsu commented 8 years ago

I am using codeship and mupx to deploy my meteor app. It works fine on local but not on the server. I have tried giving 777 permissions to /opt/myapp, but it still wont work.

Setup:

Meteor.startup(function() { UploadServer.init({ tmpDir: process.env.PWD + '/.uploads/tmp', uploadDir: process.env.PWD + '/.uploads/', checkCreateDirectories: true, //create the directories for you getDirectory: function(fileInfo, formData) { return formData.contentType; }, finished: function(fileInfo, formFields) { console.log("upload finished..."); console.log("fileInfo: ", fileInfo); console.log("formFields: ", formFields); }, overwrite: true, imageVersions: { thumbnailBig: { width: 400, height: 400 }, thumbnailSmall: { width: 200, height: 200 } } }); });

appjitsu commented 8 years ago

here is the mupx log:

...
[104.131.69.32] Created directory: /opt/myapp/
[104.131.69.32] Created directory: /opt/myapp/.uploads/
[104.131.69.32] Created directory: /opt/myapp/.uploads/tmp/
...

file uploaded:

[104.131.69.32] upload finished...
[104.131.69.32] fileInfo:  { name: 'batman.jpg',
[104.131.69.32]   path: 'images/batman.jpg',
[104.131.69.32]   size: 83223,
[104.131.69.32]   type: 'image/jpeg',
[104.131.69.32]   subDirectory: 'images',
[104.131.69.32]   baseUrl: 'http://xxx.xxx.xxx.xxx/upload/',
[104.131.69.32]   url: 'http://xxx.xxx.xxx.xxx/upload/images/batman.jpg',
[104.131.69.32]   error: null }
[104.131.69.32] formFields:  { contentType: 'images' }
[104.131.69.32] Error: spawn ENOENT
[104.131.69.32]     at errnoException (child_process.js:1011:11)
[104.131.69.32]     at Process.ChildProcess._handle.onexit (child_process.js:802:34)
appjitsu commented 8 years ago

http://xxx.xxx.xxx.xxx/upload/images/batman.jpg works, fine.

I still get the following in the browser console and the image in the browser is blank:

POST http://xxx.xxx.xxx.xxx/upload net::ERR_CONNECTION_REFUSED
GET http://xxx.xxx.xxx.xxx/sockjs/info?cb=6jw5zmfe7s net::ERR_CONNECTION_REFUSED
GET http://xxx.xxx.xxx.xxx/sockjs/info?cb=r4cq90pxnd net::ERR_CONNECTION_REFUSED
GET http://xxx.xxx.xxx.xxx/sockjs/info?cb=sm4ud7uh5q net::ERR_CONNECTION_REFUSED
appjitsu commented 8 years ago

OK So I deployed the app to another server and it works there. The other server has cloudflare in front of it, so I wonder if that is it...

I know that cloudflare does not like websockets.

tomitrescak commented 8 years ago

Dears, these questions keep appearing on the forum an in 95% cases it is due to permissions to write on your server. The 5% cases relate to cross-browser policies in some rare cases. The upload uses regular POST .. no websockets so it is not a websocket issue.

appjitsu commented 8 years ago

Hmm ok, well then ill have to do some digging. Thanks for your feedback.