Skip to content

Parse.Cloud.httpRequest crashing on Parse Server Heroku #783

Description

@wavo89

Running Parse-Server 2.1.3

OpenTokSDK.prototype.apiRequest = function(endpoint, authScheme, options, cb) {

  // options is optional
  if (cb === undefined) { cb = options; options = {}; }

  var requestOptions = {
    url: urlFromEndpoint(endpoint, options.endpoint),
    method: methodFromEndpoint(endpoint),
    headers: {},
    body: options.data || {},
    success: function(response) {
      cb(null, response);
    },
    error: function(response) {
      cb(new Error("Request failed with response code " + response.status + "\n" +
                   "Raw response: \n" + response.text + "\n"));
    }
  };

  if (authScheme === AUTH.PARTNER) {
    requestOptions.headers[authScheme] = this.apiKey + ':' + this.apiSecret;
  } else if (authScheme === AUTH.TOKEN) {
    requestOptions.headers[authScheme] = this.generateToken.apply( this, options.auth );
  } else {
    console.warn("OpenTok: No known authentication scheme chosen for the following request: \n" +
      JSON.stringify(requestOptions) + "\n");
  }

  Parse.Cloud.httpRequest(requestOptions);
  console.log("OpenTok: Sent the following request: \n" + JSON.stringify(requestOptions) + "\n");
  return;
};

Parse.Cloud.httpRequest(requestOptions) is line 196.

The command line:

Uncaught internal server error. [TypeError: Cannot read property 'statusCode' of undefined] TypeError: Cannot read property 'statusCode' of undefined
2016-03-03T01:47:51.698829+00:00 app[web.1]:     at Request._callback (/app/node_modules/parse-server/lib/httpRequest.js:46:35)
2016-03-03T01:47:51.698830+00:00 app[web.1]:     at self.callback (/app/node_modules/request/request.js:199:22)
2016-03-03T01:47:51.698831+00:00 app[web.1]:     at emitOne (events.js:90:13)
2016-03-03T01:47:51.698832+00:00 app[web.1]:     at Request.emit (events.js:182:7)
2016-03-03T01:47:51.698832+00:00 app[web.1]:     at setContentLength (/app/node_modules/request/request.js:451:14)
2016-03-03T01:47:51.698833+00:00 app[web.1]:     at Request.init (/app/node_modules/request/request.js:456:5)
2016-03-03T01:47:51.698834+00:00 app[web.1]:     at new Request (/app/node_modules/request/request.js:141:8)
2016-03-03T01:47:51.698835+00:00 app[web.1]:     at request (/app/node_modules/request/index.js:55:10)
2016-03-03T01:47:51.698836+00:00 app[web.1]:     at Object.module.exports [as httpRequest] (/app/node_modules/parse-server/lib/httpRequest.js:44:3)
2016-03-03T01:47:51.698836+00:00 app[web.1]:     at OpenTokSDK.apiRequest (/app/cloud/opentok/opentok.js:196:15)

Activity

  1. flovilmart commented on Mar 3, 2016

    @flovilmart
    Contributor

    Should be fixed with #773 stay tuned for the next release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions