{"action":"opened","issue":{"url":"https://api.github.com/repos/CulturalMe/meteor-slingshot/issues/169","repository_url":"https://api.github.com/repos/CulturalMe/meteor-slingshot","labels_url":"https://api.github.com/repos/CulturalMe/meteor-slingshot/issues/169/labels{/name}","comments_url":"https://api.github.com/repos/CulturalMe/meteor-slingshot/issues/169/comments","events_url":"https://api.github.com/repos/CulturalMe/meteor-slingshot/issues/169/events","html_url":"https://github.com/CulturalMe/meteor-slingshot/issues/169","id":138480282,"number":169,"title":"After deploying, the app fails to upload files to S3 gives Unexpected token < error","user":{"login":"THPubs","id":1212023,"avatar_url":"https://avatars.githubusercontent.com/u/1212023?v=3","gravatar_id":"","url":"https://api.github.com/users/THPubs","html_url":"https://github.com/THPubs","followers_url":"https://api.github.com/users/THPubs/followers","following_url":"https://api.github.com/users/THPubs/following{/other_user}","gists_url":"https://api.github.com/users/THPubs/gists{/gist_id}","starred_url":"https://api.github.com/users/THPubs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/THPubs/subscriptions","organizations_url":"https://api.github.com/users/THPubs/orgs","repos_url":"https://api.github.com/users/THPubs/repos","events_url":"https://api.github.com/users/THPubs/events{/privacy}","received_events_url":"https://api.github.com/users/THPubs/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-04T13:45:54Z","updated_at":"2016-03-04T13:45:54Z","closed_at":null,"body":"I tried to upload files to my S3 bucket bay getting the credentials from the Ec 2 instance (The app is hosted in EC2). Here's the directive :\r\n\r\n    var credentials = new AWS.EC2MetadataCredentials();\r\n\r\n    var updateCredentials = Meteor.wrapAsync(credentials.get, credentials);\r\n\r\n\r\n    Slingshot.createDirective(\"achievementPhotoUpload\", Slingshot.S3Storage.TempCredentials, {\r\n      bucket: \"...\",\r\n\r\n      acl: \"public-read\",\r\n\r\n      region: \"...\",\r\n\r\n      temporaryCredentials: function () {\r\n        if (credentials.needsRefresh()) {\r\n          updateCredentials();\r\n        }\r\n\r\n        return {\r\n          AccessKeyId: credentials.accessKeyId,\r\n          SecretAccessKey: credentials.secretAccessKey,\r\n          SessionToken: credentials.sessionToken\r\n        };\r\n      },\r\n\r\n      authorize: function () {\r\n        //Deny uploads if user is not logged in.\r\n        if (!this.userId) {\r\n          var message = \"Please login before posting files\";\r\n          throw new Meteor.Error(\"Login Required\", message);\r\n        }\r\n\r\n        return true;\r\n      },\r\n\r\n      key: function (file) {\r\n        return \"achievement-photos/\" + file.name;\r\n      }\r\n    });\r\n\r\n\r\nBut it won't upload. When I check the logs, I found this :\r\n\r\n    Session terminated, terminating shell... ...terminated.\r\n    `Meteor.addCollectionExtension` is deprecated, please use `CollectionExtensions.addExtension`\r\n    Exception while invoking method 'slingshot/uploadRequest' SyntaxError: Unexpected token <\r\n        at Object.Future.wait (/opt/kwabackend/app/programs/server/node_modules/fibers/future.js:420:15)\r\n        at packages/meteor/helpers.js:119:1\r\n        at Object.temporaryCredentials (server/uploaders/AchievementPhotosAccess.js:21:7)\r\n        at Object.Slingshot.S3Storage.TempCredentials._.defaults.applySignature (packages/edgee_slingshot/packages/edgee_slingshot.js:776:$\r\n        at Object.Slingshot.S3Storage.upload (packages/edgee_slingshot/packages/edgee_slingshot.js:696:1)\r\n        at [object Object]._.extend.getInstructions (packages/edgee_slingshot/packages/edgee_slingshot.js:343:1)\r\n        at [object Object].Meteor.methods.slingshot/uploadRequest (packages/edgee_slingshot/packages/edgee_slingshot.js:425:1)\r\n        at packages/check/match.js:103:1\r\n        at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)\r\n        at Object.Match._failIfArgumentsAreNotAllChecked (packages/check/match.js:102:1)\r\n        - - - - -\r\n        at Object.parse (native)\r\n        at /opt/kwabackend/app/programs/server/npm/peerlibrary_aws-sdk/node_modules/aws-sdk/lib/metadata_service.js:115:38\r\n        at IncomingMessage.<anonymous> (/opt/kwabackend/app/programs/server/npm/peerlibrary_aws-sdk/node_modules/aws-sdk/lib/metadata_serv$\r\n        at IncomingMessage.emit (events.js:117:20)\r\n        at _stream_readable.js:944:16\r\n        at process._tickDomainCallback (node.js:492:13)\r\n\r\nAny idea what's happening?\r\n"}}