CocoonIO / cocoon-cloud-sdk

The Cocoon SDK is the easiest way to integrate your app with the Cocoon Cloud Compiler
http://cocoon.io
MIT License
9 stars 4 forks source link

Cocoon API responds with nondescript 500-error #11

Open Joncom opened 6 years ago

Joncom commented 6 years ago
$ pwd
REDACTED/cocoon-cloud-sdk/sample/gulp
$ gulp updateSource --clientId=REDACTED --clientSecret=REDACTED --username=REDACTED --password=REDACTED --projectId=ca.commins.stomp --zipPath=../../../cocoon-game/Archive.zip
[17:22:25] Using gulpfile /Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/gulpfile.js
[17:22:25] Starting 'login'...
[17:22:37] Finished 'login' after 12 s
[17:22:37] Starting 'updateSource'...
Trace: { PopsicleError: https://api.cocoon.io/v1/project/ca.commins.stomp responded with 500, expected it to be between 200 and 399
    at Request.error (/Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/node_modules/popsicle/dist/request.js:41:16)
    at /Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/node_modules/popsicle-status/popsicle-status.js:31:23
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
  cause: undefined,
  code: 'EINVALIDSTATUS',
  popsicle:
   Request {
     Url:
      Url {
        protocol: 'https:',
        slashes: true,
        auth: null,
        host: 'api.cocoon.io',
        port: null,
        hostname: 'api.cocoon.io',
        hash: null,
        search: null,
        query: {},
        pathname: '/v1/project/ca.commins.stomp',
        path: '/v1/project/ca.commins.stomp',
        href: 'https://api.cocoon.io/v1/project/ca.commins.stomp' },
     rawHeaders:
      [ 'Authorization',
        'Bearer REDACTED',
        'Accept',
        '*/*',
        'User-Agent',
        'Popsicle (https://github.com/blakeembrey/popsicle)',
        'Accept-Encoding',
        'gzip,deflate' ],
     middleware: [ [Function], [Function], [Function], [Function] ],
     opened: true,
     aborted: false,
     uploaded: 1,
     downloaded: 1,
     timeout: 0,
     method: 'GET',
     body: null,
     events: { abort: [Array] },
     transport:
      { use: [Array],
        abort: [Function: abort],
        open: [Function: open] },
     _promise: Promise { <rejected> [Circular] },
     _raw:
      ClientRequest {
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: true,
        _last: true,
        upgrading: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: 0,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [TLSSocket],
        connection: [TLSSocket],
        _header: 'GET /v1/project/ca.commins.stomp HTTP/1.1\r\nAuthorization: Bearer REDACTED\r\nAccept: */*\r\nUser-Agent: Popsicle (https://github.com/blakeembrey/popsicle)\r\nAccept-Encoding: gzip,deflate\r\nHost: api.cocoon.io\r\nConnection: close\r\n\r\n',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Agent],
        socketPath: undefined,
        timeout: undefined,
        method: 'GET',
        path: '/v1/project/ca.commins.stomp',
        _ended: true,
        res: [IncomingMessage],
        aborted: undefined,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: null,
        maxHeadersCount: null,
        [Symbol(outHeadersKey)]: [Object] },
     uploadLength: null,
     uploadedBytes: 0,
     downloadLength: 67,
     downloadedBytes: 67 },
  status: 500,
  res:
   Response {
     Url:
      Url {
        protocol: 'https:',
        slashes: true,
        auth: null,
        host: 'api.cocoon.io',
        port: null,
        hostname: 'api.cocoon.io',
        hash: null,
        search: null,
        query: {},
        pathname: '/v1/project/ca.commins.stomp',
        path: '/v1/project/ca.commins.stomp',
        href: 'https://api.cocoon.io/v1/project/ca.commins.stomp' },
     rawHeaders:
      [ 'Access-Control-Allow-Headers',
        'Origin,X-Requested-With,Content-Type,Accept,Authorization,',
        'Access-Control-Allow-Methods',
        'GET, POST, DELETE, PUT, OPTIONS',
        'Access-Control-Allow-Origin',
        '*',
        'Content-Type',
        'application/json;charset=utf-8',
        'Date',
        'Sun, 14 Jan 2018 10:22:46 GMT',
        'Server',
        'nginx/1.4.6 (Ubuntu)',
        'X-Powered-By',
        'Undertow/1',
        'Content-Length',
        '67',
        'Connection',
        'Close' ],
     body:
      { status: 'ERROR',
        description: 'Internal server error',
        code: 500 },
     status: 500,
     statusText: 'Internal Server Error' } }
    at cocoon_api_1.default.request.use.then.catch (/Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/node_modules/cocoon-cloud-sdk/out/lib/project-api.js:148:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
Trace: { PopsicleError: https://api.cocoon.io/v1/project/ca.commins.stomp responded with 500, expected it to be between 200 and 399
    at Request.error (/Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/node_modules/popsicle/dist/request.js:41:16)
    at /Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/node_modules/popsicle-status/popsicle-status.js:31:23
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
  cause: undefined,
  code: 'EINVALIDSTATUS',
  popsicle:
   Request {
     Url:
      Url {
        protocol: 'https:',
        slashes: true,
        auth: null,
        host: 'api.cocoon.io',
        port: null,
        hostname: 'api.cocoon.io',
        hash: null,
        search: null,
        query: {},
        pathname: '/v1/project/ca.commins.stomp',
        path: '/v1/project/ca.commins.stomp',
        href: 'https://api.cocoon.io/v1/project/ca.commins.stomp' },
     rawHeaders:
      [ 'Authorization',
        'Bearer REDACTED',
        'Accept',
        '*/*',
        'User-Agent',
        'Popsicle (https://github.com/blakeembrey/popsicle)',
        'Accept-Encoding',
        'gzip,deflate' ],
     middleware: [ [Function], [Function], [Function], [Function] ],
     opened: true,
     aborted: false,
     uploaded: 1,
     downloaded: 1,
     timeout: 0,
     method: 'GET',
     body: null,
     events: { abort: [Array] },
     transport:
      { use: [Array],
        abort: [Function: abort],
        open: [Function: open] },
     _promise: Promise { <rejected> [Circular] },
     _raw:
      ClientRequest {
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: true,
        _last: true,
        upgrading: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: 0,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [TLSSocket],
        connection: [TLSSocket],
        _header: 'GET /v1/project/ca.commins.stomp HTTP/1.1\r\nAuthorization: Bearer REDACTED\r\nAccept: */*\r\nUser-Agent: Popsicle (https://github.com/blakeembrey/popsicle)\r\nAccept-Encoding: gzip,deflate\r\nHost: api.cocoon.io\r\nConnection: close\r\n\r\n',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Agent],
        socketPath: undefined,
        timeout: undefined,
        method: 'GET',
        path: '/v1/project/ca.commins.stomp',
        _ended: true,
        res: [IncomingMessage],
        aborted: undefined,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: null,
        maxHeadersCount: null,
        [Symbol(outHeadersKey)]: [Object] },
     uploadLength: null,
     uploadedBytes: 0,
     downloadLength: 67,
     downloadedBytes: 67 },
  status: 500,
  res:
   Response {
     Url:
      Url {
        protocol: 'https:',
        slashes: true,
        auth: null,
        host: 'api.cocoon.io',
        port: null,
        hostname: 'api.cocoon.io',
        hash: null,
        search: null,
        query: {},
        pathname: '/v1/project/ca.commins.stomp',
        path: '/v1/project/ca.commins.stomp',
        href: 'https://api.cocoon.io/v1/project/ca.commins.stomp' },
     rawHeaders:
      [ 'Access-Control-Allow-Headers',
        'Origin,X-Requested-With,Content-Type,Accept,Authorization,',
        'Access-Control-Allow-Methods',
        'GET, POST, DELETE, PUT, OPTIONS',
        'Access-Control-Allow-Origin',
        '*',
        'Content-Type',
        'application/json;charset=utf-8',
        'Date',
        'Sun, 14 Jan 2018 10:22:46 GMT',
        'Server',
        'nginx/1.4.6 (Ubuntu)',
        'X-Powered-By',
        'Undertow/1',
        'Content-Length',
        '67',
        'Connection',
        'Close' ],
     body:
      { status: 'ERROR',
        description: 'Internal server error',
        code: 500 },
     status: 500,
     statusText: 'Internal Server Error' } }
    at ProjectAPI.getUnprocessed.then.catch (/Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/node_modules/cocoon-cloud-sdk/out/lib/project-api.js:129:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
Project with ID: ca.commins.stomp couldn't be fetched.
Trace: { PopsicleError: https://api.cocoon.io/v1/project/ca.commins.stomp responded with 500, expected it to be between 200 and 399
    at Request.error (/Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/node_modules/popsicle/dist/request.js:41:16)
    at /Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/node_modules/popsicle-status/popsicle-status.js:31:23
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
  cause: undefined,
  code: 'EINVALIDSTATUS',
  popsicle:
   Request {
     Url:
      Url {
        protocol: 'https:',
        slashes: true,
        auth: null,
        host: 'api.cocoon.io',
        port: null,
        hostname: 'api.cocoon.io',
        hash: null,
        search: null,
        query: {},
        pathname: '/v1/project/ca.commins.stomp',
        path: '/v1/project/ca.commins.stomp',
        href: 'https://api.cocoon.io/v1/project/ca.commins.stomp' },
     rawHeaders:
      [ 'Authorization',
        'Bearer REDACTED',
        'Accept',
        '*/*',
        'User-Agent',
        'Popsicle (https://github.com/blakeembrey/popsicle)',
        'Accept-Encoding',
        'gzip,deflate' ],
     middleware: [ [Function], [Function], [Function], [Function] ],
     opened: true,
     aborted: false,
     uploaded: 1,
     downloaded: 1,
     timeout: 0,
     method: 'GET',
     body: null,
     events: { abort: [Array] },
     transport:
      { use: [Array],
        abort: [Function: abort],
        open: [Function: open] },
     _promise: Promise { <rejected> [Circular] },
     _raw:
      ClientRequest {
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: true,
        _last: true,
        upgrading: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: 0,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [TLSSocket],
        connection: [TLSSocket],
        _header: 'GET /v1/project/ca.commins.stomp HTTP/1.1\r\nAuthorization: Bearer REDACTED\r\nAccept: */*\r\nUser-Agent: Popsicle (https://github.com/blakeembrey/popsicle)\r\nAccept-Encoding: gzip,deflate\r\nHost: api.cocoon.io\r\nConnection: close\r\n\r\n',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Agent],
        socketPath: undefined,
        timeout: undefined,
        method: 'GET',
        path: '/v1/project/ca.commins.stomp',
        _ended: true,
        res: [IncomingMessage],
        aborted: undefined,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: null,
        maxHeadersCount: null,
        [Symbol(outHeadersKey)]: [Object] },
     uploadLength: null,
     uploadedBytes: 0,
     downloadLength: 67,
     downloadedBytes: 67 },
  status: 500,
  res:
   Response {
     Url:
      Url {
        protocol: 'https:',
        slashes: true,
        auth: null,
        host: 'api.cocoon.io',
        port: null,
        hostname: 'api.cocoon.io',
        hash: null,
        search: null,
        query: {},
        pathname: '/v1/project/ca.commins.stomp',
        path: '/v1/project/ca.commins.stomp',
        href: 'https://api.cocoon.io/v1/project/ca.commins.stomp' },
     rawHeaders:
      [ 'Access-Control-Allow-Headers',
        'Origin,X-Requested-With,Content-Type,Accept,Authorization,',
        'Access-Control-Allow-Methods',
        'GET, POST, DELETE, PUT, OPTIONS',
        'Access-Control-Allow-Origin',
        '*',
        'Content-Type',
        'application/json;charset=utf-8',
        'Date',
        'Sun, 14 Jan 2018 10:22:46 GMT',
        'Server',
        'nginx/1.4.6 (Ubuntu)',
        'X-Powered-By',
        'Undertow/1',
        'Content-Length',
        '67',
        'Connection',
        'Close' ],
     body:
      { status: 'ERROR',
        description: 'Internal server error',
        code: 500 },
     status: 500,
     statusText: 'Internal Server Error' } }
    at cocoonSDK.ProjectAPI.get.catch (/Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/gulpfile.js:98:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
Trace: { PopsicleError: https://api.cocoon.io/v1/project/ca.commins.stomp responded with 500, expected it to be between 200 and 399
    at Request.error (/Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/node_modules/popsicle/dist/request.js:41:16)
    at /Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/node_modules/popsicle-status/popsicle-status.js:31:23
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
  cause: undefined,
  code: 'EINVALIDSTATUS',
  popsicle:
   Request {
     Url:
      Url {
        protocol: 'https:',
        slashes: true,
        auth: null,
        host: 'api.cocoon.io',
        port: null,
        hostname: 'api.cocoon.io',
        hash: null,
        search: null,
        query: {},
        pathname: '/v1/project/ca.commins.stomp',
        path: '/v1/project/ca.commins.stomp',
        href: 'https://api.cocoon.io/v1/project/ca.commins.stomp' },
     rawHeaders:
      [ 'Authorization',
        'Bearer REDACTED',
        'Accept',
        '*/*',
        'User-Agent',
        'Popsicle (https://github.com/blakeembrey/popsicle)',
        'Accept-Encoding',
        'gzip,deflate' ],
     middleware: [ [Function], [Function], [Function], [Function] ],
     opened: true,
     aborted: false,
     uploaded: 1,
     downloaded: 1,
     timeout: 0,
     method: 'GET',
     body: null,
     events: { abort: [Array] },
     transport:
      { use: [Array],
        abort: [Function: abort],
        open: [Function: open] },
     _promise: Promise { <rejected> [Circular] },
     _raw:
      ClientRequest {
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        output: [],
        outputEncodings: [],
        outputCallbacks: [],
        outputSize: 0,
        writable: true,
        _last: true,
        upgrading: false,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: 0,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [TLSSocket],
        connection: [TLSSocket],
        _header: 'GET /v1/project/ca.commins.stomp HTTP/1.1\r\nAuthorization: Bearer REDACTED\r\nAccept: */*\r\nUser-Agent: Popsicle (https://github.com/blakeembrey/popsicle)\r\nAccept-Encoding: gzip,deflate\r\nHost: api.cocoon.io\r\nConnection: close\r\n\r\n',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Agent],
        socketPath: undefined,
        timeout: undefined,
        method: 'GET',
        path: '/v1/project/ca.commins.stomp',
        _ended: true,
        res: [IncomingMessage],
        aborted: undefined,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: null,
        maxHeadersCount: null,
        [Symbol(outHeadersKey)]: [Object] },
     uploadLength: null,
     uploadedBytes: 0,
     downloadLength: 67,
     downloadedBytes: 67 },
  status: 500,
  res:
   Response {
     Url:
      Url {
        protocol: 'https:',
        slashes: true,
        auth: null,
        host: 'api.cocoon.io',
        port: null,
        hostname: 'api.cocoon.io',
        hash: null,
        search: null,
        query: {},
        pathname: '/v1/project/ca.commins.stomp',
        path: '/v1/project/ca.commins.stomp',
        href: 'https://api.cocoon.io/v1/project/ca.commins.stomp' },
     rawHeaders:
      [ 'Access-Control-Allow-Headers',
        'Origin,X-Requested-With,Content-Type,Accept,Authorization,',
        'Access-Control-Allow-Methods',
        'GET, POST, DELETE, PUT, OPTIONS',
        'Access-Control-Allow-Origin',
        '*',
        'Content-Type',
        'application/json;charset=utf-8',
        'Date',
        'Sun, 14 Jan 2018 10:22:46 GMT',
        'Server',
        'nginx/1.4.6 (Ubuntu)',
        'X-Powered-By',
        'Undertow/1',
        'Content-Length',
        '67',
        'Connection',
        'Close' ],
     body:
      { status: 'ERROR',
        description: 'Internal server error',
        code: 500 },
     status: 500,
     statusText: 'Internal Server Error' } }
    at fetchProject.then.catch (/Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/gulpfile.js:236:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
[17:22:47] 'updateSource' errored after 10 s
[17:22:47] PopsicleError: https://api.cocoon.io/v1/project/ca.commins.stomp responded with 500, expected it to be between 200 and 399
    at Request.error (/Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/node_modules/popsicle/dist/request.js:41:16)
    at /Library/WebServer/Documents/LTM/stomp/_build/cocoon-cloud-sdk/sample/gulp/node_modules/popsicle-status/popsicle-status.js:31:23
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
Joncom commented 6 years ago

Generally speaking, a 500 error suggests something is going wrong on the Cocoon side?

Joncom commented 6 years ago

I think I figured it out.

I was supplying my project “Bundle ID” (ca.commins.stomp), instead of the “Project ID” (m_DAf2uHoJzrv5xlCs7aSg).

This “Project ID” seems nowhere to be found in the Cocoon dashboard, however I noticed the URL when editing my game:

https://cocoon.io/projects/m_DAf2uHoJzrv5xlCs7aSg

Therefore, the project ID can be found in the URL when viewing your game, and appears to be 22 characters long.

Would be nice if this was documented somewhere.

Joncom commented 6 years ago

This is the JSON the Cocoon API served with the 500 error:

{ status: 'ERROR',
        description: 'Internal server error',
        code: 500 }

Would be great if the API provided a more meaningful error message.