Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18838] ACS Photo uploads fail with 500 error

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2015-05-08T18:27:32.000+0000
Affected Version/sRelease 4.0.0
Fix Version/sRelease 4.0.0, Release 4.1.0
ComponentsTiAPI
Labelsacs, photo, regression, upload
ReporterSebastian Klaus
AssigneeVishal Duggal
Created2015-04-15T12:52:01.000+0000
Updated2015-05-16T18:42:16.000+0000

Description

Photos returned a 500
[INFO] [iphone, 8.1, undefined] {
    "success": false,
    "error": true,
    "code": 500,
    "message": "Internal server error. The Appcelerator Cloud Services Team has just been notified of this problem."
}
Please have a look at it.

Comments

  1. Fokke Zandbergen 2015-04-15

    Could you include the parameters/URL used for this return to happen? And does it always reproduce? CC [~mgadiya]
  2. Sebastian Klaus 2015-04-15

    I can confirm, that this only happens compiled with 4.0.0.Beta2. SDK 3.5.1.GA works as expected. This ist my code:
       Cloud.onsendstream = function (e) {
           progressBar.value = e.progress;
       };
       
       Cloud.Photos.create({
           photo: image,
           'photo_sync_sizes[]': 'square_75',
           'photo_sync_sizes[]': 'small_240',
           'photo_sync_sizes[]': 'medium_500'
       }, function (e) {
           Cloud.onsendstream = Cloud.ondatastream = null;
           Ti.App.indicator.hide();
           if (e.success) {
               var photo = e.photos[0];
               self.fireEvent('upload.image.success', {
                   url: photo.urls.original
               });
           } else {
               console.log(e);
               self.fireEvent('upload.image.error', {});
           }
       });
       
    Working environment:
       Operating System
         Name                        = Mac OS X
         Version                     = 10.10.3
         Architecture                = 64bit
         # CPUs                      = 8
         Memory                      = 17179869184
       
       Node.js
         Node.js Version             = 0.10.38
         npm Version                 = 1.4.28
       
       Titanium CLI
         CLI Version                 = 3.4.2
       
       Titanium SDK
         SDK Version                 = 3.5.1.GA
         SDK Path                    = /Volumes/Data/Users/sebastian/Library/Application Support/Titanium/mobilesdk/osx/3.5.1.GA
         Target Platform             = iphone
       
    Using latest ti.cloud 3.2.8
  3. Sebastian Klaus 2015-04-16

    [~fokkezb] can you reproduce this?
  4. Fokke Zandbergen 2015-04-16

    I will let that up to [~rtlechuga] if you don't mind ;)
  5. Sebastian Klaus 2015-04-16

    Of course :-) Thank you
  6. Shuo Liang 2015-04-17

    Problem can be reproduced on SDK 4.0.0 Bate2, and works well on SDK 3.5.1 as customer mentioned. Test Case:
       var win = Ti.UI.createWindow({
       	backgroundColor:"white"
       });
       
       var Cloud = require("ti.cloud");
       
       Cloud.Users.login({
           login: <email>,
           password: <password>
       }, function (e) {
           if (e.success) {
               var user = e.users[0];
               Ti.API.info('Success:\n' +
                   'id: ' + user.id + '\n' +
                   'sessionId: ' + Cloud.sessionId + '\n' +
                   'first name: ' + user.first_name + '\n' +
                   'last name: ' + user.last_name);
               upload();
           } else {
               alert('Error:\n' +
                   ((e.error && e.message) || JSON.stringify(e)));
           }
       });
       
       function upload(e) {
       	Cloud.Photos.create({
           	photo: Titanium.Filesystem.getFile('1.jpg')
       	}, function (e) {
           	if (e.success) {
               	var photo = e.photos[0];
               	Ti.API.info('Success:\n' +
                   	'id: ' + photo.id + '\n' +
                   	'filename: ' + photo.filename + '\n' +
                   	'size: ' + photo.size,
                   	'updated_at: ' + photo.updated_at);
           	} else {
               	Ti.API.info('Error:\n' + JSON.stringify(e));
           	}
       	});
       }
       
       
       win.open();
       
    Also I tried Curl command with REST API, It works well.
       Appc-MBP:~ shuoliang$ curl -b cookies.txt -c cookies.txt  -F "file=@1.jpg" "https://api.cloud.appcelerator.com/v1/photos/create.json?ey=8uupo7jRs0vwJP6qCDPvzckmmtNNnZE3&pretty_json=true"
       {
         "meta": {
           "code": 200,
           "status": "ok",
           "method_name": "createPhoto"
         },
         "response": {
           "photos": [
             {
               "id": "55305d95da00eeadda00094c",
               "filename": "1.jpg",
               "size": 75005,
               "md5": "d30e5da6d6aef073e7b06b980f40090c",
               "created_at": "2015-04-17T01:10:45+0000",
               "updated_at": "2015-04-17T01:10:45+0000",
               "processed": false,
               "content_type": "image/jpeg",
               "user_id": "55305794442599bbd8c525cc"
             }
           ]
         }
       }
       
    So I believe this is the problem from SDK.
  7. Sebastian Klaus 2015-04-18

    Any news for that? I think this is really urgent for all developer who are using ACS
  8. Ingo Muschenetz 2015-04-18

    Thank you for the bump. We will fix.
  9. Eric Wieber 2015-05-07

    I am able to reproduce this today, using: MacOS 10.10.3 Studio 4.0.0.201505070727 Ti SDK 4.0.0.v20150507131012 Appc NPM 0.3.55 Appc CLI 0.2.280 Ti CLI 4.0.0-beta8 Alloy 1.6.0-beta4 Node v0.10.37
  10. Mukesh Gadiya 2015-05-07

    [~wkong] , [~ewieber] ran into similar problem and I looked up the logs on api node and this is showed up:
        Started POST "/v1/photos/create.json?key=nLu8hACXPzfMdRPDBNP23ENDkfcqiqZ4&_session_id=PSx4ZylgHMBwO7ZI4_9ZzLLN_-Y" for 38.110.144.252 at 2015-05-07 21:24:20 +0000
        MONGODB (0.9ms) acs_api['action_dispatch_session_mongoid_store_sessions'].find({:_id=>"PSx4ZylgHMBwO7ZI4_9ZzLLN_-Y"}).limit(-1)
        
        NoMethodError (undefined method rewind' for #<String:0x0000000b8a3198>):
          config/initializers/SessionCookieMiddelware.rb:52:in call'
        
        
    I think we may have possible ACS issue here.
  11. Alex Bernier 2015-05-08

    I'm seeing this issue uploading photos to a destination other than ACS, only in the 4.0.0.x Ti SDK on iOS. Works on Android. I don't think this is an ACS issue. Looking into it more now. First error I see is:
        Error when matching URL mapping [/(*)/(*)?/(*)?(.(*))?]:Invalid media type "charset="utf-8"": does not contain '/'
        
  12. Vishal Duggal 2015-05-08

    Pulls pending APSHTTPClient - https://github.com/appcelerator/APSHTTPClient/pull/24 Titanium Mobile master - https://github.com/appcelerator/titanium_mobile/pull/6828 4_0_X - https://github.com/appcelerator/titanium_mobile/pull/6829
  13. Alex Bernier 2015-05-08

    Booyah. Thank you, All!
  14. Ewan Harris 2015-05-16

    Verified using: Mac OSX 10.10.3 Titanium SDK build: 4.0.0.v20150515213410 Appc CLI (NPM): 0.3.56 Appc CLI (Registry): 0.2.287 Using the code attached by Shuo, when uploading a photo to ACS the upload is now successful. Closing ticket

JSON Source