{"action":"created","issue":{"url":"https://api.github.com/repos/jalik/jalik-ufs/issues/58","repository_url":"https://api.github.com/repos/jalik/jalik-ufs","labels_url":"https://api.github.com/repos/jalik/jalik-ufs/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/jalik/jalik-ufs/issues/58/comments","events_url":"https://api.github.com/repos/jalik/jalik-ufs/issues/58/events","html_url":"https://github.com/jalik/jalik-ufs/issues/58","id":170586056,"number":58,"title":"Unable to get it working on mobile devices (IOS and Android)","user":{"login":"rawacharya","id":7614499,"avatar_url":"https://avatars.githubusercontent.com/u/7614499?v=3","gravatar_id":"","url":"https://api.github.com/users/rawacharya","html_url":"https://github.com/rawacharya","followers_url":"https://api.github.com/users/rawacharya/followers","following_url":"https://api.github.com/users/rawacharya/following{/other_user}","gists_url":"https://api.github.com/users/rawacharya/gists{/gist_id}","starred_url":"https://api.github.com/users/rawacharya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rawacharya/subscriptions","organizations_url":"https://api.github.com/users/rawacharya/orgs","repos_url":"https://api.github.com/users/rawacharya/repos","events_url":"https://api.github.com/users/rawacharya/events{/privacy}","received_events_url":"https://api.github.com/users/rawacharya/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jalik/jalik-ufs/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":{"login":"jalik","id":1948429,"avatar_url":"https://avatars.githubusercontent.com/u/1948429?v=3","gravatar_id":"","url":"https://api.github.com/users/jalik","html_url":"https://github.com/jalik","followers_url":"https://api.github.com/users/jalik/followers","following_url":"https://api.github.com/users/jalik/following{/other_user}","gists_url":"https://api.github.com/users/jalik/gists{/gist_id}","starred_url":"https://api.github.com/users/jalik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jalik/subscriptions","organizations_url":"https://api.github.com/users/jalik/orgs","repos_url":"https://api.github.com/users/jalik/repos","events_url":"https://api.github.com/users/jalik/events{/privacy}","received_events_url":"https://api.github.com/users/jalik/received_events","type":"User","site_admin":false},"assignees":[{"login":"jalik","id":1948429,"avatar_url":"https://avatars.githubusercontent.com/u/1948429?v=3","gravatar_id":"","url":"https://api.github.com/users/jalik","html_url":"https://github.com/jalik","followers_url":"https://api.github.com/users/jalik/followers","following_url":"https://api.github.com/users/jalik/following{/other_user}","gists_url":"https://api.github.com/users/jalik/gists{/gist_id}","starred_url":"https://api.github.com/users/jalik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jalik/subscriptions","organizations_url":"https://api.github.com/users/jalik/orgs","repos_url":"https://api.github.com/users/jalik/repos","events_url":"https://api.github.com/users/jalik/events{/privacy}","received_events_url":"https://api.github.com/users/jalik/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-08-11T07:33:15Z","updated_at":"2016-08-13T01:41:59Z","closed_at":null,"body":"Having been banging my head around and trying to get it work with image upload, I finally decided to create an issue. I am trying to create a mobile-only app on Meteor that allows my app users to upload images. Came to know about this pretty awesome package and decided to use it. \r\n\r\nI am using the following code snippet to upload an image from the client. \r\n\r\n```\r\nexport const upload = (dataUrl, name, provider, resolve, reject) => {  \r\n\r\n\tconst blob = dataURLToBlob(dataUrl);  \r\n\r\n\tconst photo = {\r\n\t\tname: name,\r\n\t\tsize: blob.size,\r\n\t\ttype: blob.type,\r\n\t\tprovider: provider\r\n\t};\r\n\r\n\tconst uploader = new UploadFS.Uploader({\r\n\t store: ImagesStore,\r\n\t data: blob,\r\n\t file: photo,\r\n\t onError: reject,\r\n\t onComplete: resolve\r\n\t});\r\n\r\n\tuploader.start();\r\n};\r\n```\r\nI am using the following to run the app:\r\n\r\n`meteor run android-device ios --settings settings.json --mobile-server [Port forwarded external IP]`\r\n\r\nI have my app installed and running on both platforms.\r\n\r\nEverything runs fine, except when trying to upload images it gives me the following error on Android (when using chrome web-inspector) \r\n\r\n```\r\njalik_ufs.js?hash=b48a63c…:1365 POST http://localhost:3000/ufs/images/Mp49AAzGnXrxwticN?token=cbbbcaf8a8&progress=0.891597736177623 net::ERR_CONNECTION_REFUSED(anonymous function) @ jalik_ufs.js?hash=b48a63c…:1365self.readChunk @ jalik_ufs.js?hash=b48a63c…:1276(anonymous function) @ jalik_ufs.js?hash=b48a63c…:1321self.sendChunk @ jalik_ufs.js?hash=b48a63c…:1367(anonymous function) @ jalik_ufs.js?hash=b48a63c…:1393(anonymous function) @ meteor.js?hash=0b0ea10…:1133_maybeInvokeCallback @ ddp-client.js?hash=bb47c27…:3557receiveResult @ ddp-client.js?hash=bb47c27…:3577_livedata_result @ ddp-client.js?hash=bb47c27…:4742onMessage @ ddp-client.js?hash=bb47c27…:3385(anonymous function) @ ddp-client.js?hash=bb47c27…:2736_.each._.forEach @ underscore.js?hash=27b3d66…:149self.socket.onmessage @ ddp-client.js?hash=bb47c27…:2735REventTarget.dispatchEvent @ ddp-client.js?hash=bb47c27…:175SockJS._dispatchMessage @ ddp-client.js?hash=bb47c27…:1160SockJS._didMessage @ ddp-client.js?hash=bb47c27…:1218that.ws.onmessage @ ddp-client.js?hash=bb47c27…:1365\r\njalik_ufs.js?hash=b48a63c…:1365 POST http://localhost:3000/ufs/images/Mp49AAzGnXrxwticN?token=cbbbcaf8a8&progress=0.891597736177623 net::ERR_CONNECTION_REFUSED(anonymous function) @ jalik_ufs.js?hash=b48a63c…:1365self.readChunk @ jalik_ufs.js?hash=b48a63c…:1276(anonymous function) @ jalik_ufs.js?hash=b48a63c…:1321self.sendChunk @ jalik_ufs.js?hash=b48a63c…:1367withValue @ meteor.js?hash=0b0ea10…:1105(anonymous function) @ meteor.js?hash=0b0ea10…:492(anonymous function) @ meteor.js?hash=0b0ea10…:1133\r\n```\r\n\r\nAnd when using Safari Web-inspector I get the following:\r\n\r\n`XMLHttpRequest cannot load http://localhost:3000/ufs/images/xFnciqqimy7Rq6rhc?token=5bE858db99&progress=0.43186251252042807. Origin http://localhost:12968 is not allowed by Access-Control-Allow-Origin.`\r\n\r\nAny help would be much appreciated.\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/jalik/jalik-ufs/issues/comments/239594717","html_url":"https://github.com/jalik/jalik-ufs/issues/58#issuecomment-239594717","issue_url":"https://api.github.com/repos/jalik/jalik-ufs/issues/58","id":239594717,"user":{"login":"rawacharya","id":7614499,"avatar_url":"https://avatars.githubusercontent.com/u/7614499?v=3","gravatar_id":"","url":"https://api.github.com/users/rawacharya","html_url":"https://github.com/rawacharya","followers_url":"https://api.github.com/users/rawacharya/followers","following_url":"https://api.github.com/users/rawacharya/following{/other_user}","gists_url":"https://api.github.com/users/rawacharya/gists{/gist_id}","starred_url":"https://api.github.com/users/rawacharya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rawacharya/subscriptions","organizations_url":"https://api.github.com/users/rawacharya/orgs","repos_url":"https://api.github.com/users/rawacharya/repos","events_url":"https://api.github.com/users/rawacharya/events{/privacy}","received_events_url":"https://api.github.com/users/rawacharya/received_events","type":"User","site_admin":false},"created_at":"2016-08-13T01:41:59Z","updated_at":"2016-08-13T01:41:59Z","body":"I think, `Meteor.absoluteUrl()` is the culprit here.\r\n\r\nWhen I try logging `Meteor.absoluteUrl()` within the upload method, it does return my root URL which in my case is my router's external IP:Port. \r\n\r\n```\r\nexport const upload = (dataUrl, name, provider, resolve, reject) => {  \r\n\r\n    const blob = dataURLToBlob(dataUrl);  \r\n    console.log(Meteor.absoluteUrl('test')); // Returns my external IP:Port/test\r\n    const photo = {\r\n        name: name,\r\n        size: blob.size,\r\n        type: blob.type,\r\n        provider: provider\r\n    };\r\n\r\n    const uploader = new UploadFS.Uploader({\r\n     store: ImagesStore,\r\n     data: blob,\r\n     file: photo,\r\n     onError: reject,\r\n     onComplete: resolve\r\n    });\r\n\r\n    uploader.start();\r\n};\r\n```\r\nFor some reason, the Meteor.absoluteUrl() invoked from within 'ufsCreate' method is returning http://localhost:3000 as the root URL.\r\n \r\n\r\n\r\nThanks\r\nRaman"}}
{"actor":{"display_login":"rawacharya"}}