Create Project being wierd


#1

HI,

I’m having some trouble with the the Create Project functionality. Specifically, the code I am using is below.

So first I get a token, then i pass it to the below method.

case ('createOrgProject'): {
          const method = 'POST';
          const url = 'https://api.github.com/orgs/'
            + Meteor.settings.private.github.org //the name of the org
            + '/projects';

          console.log(url);

          const headers = {
            'User-Agent': 'Meteor/1.0',
            'Accept': 'application/vnd.github.inertia-preview+json',
            'Authorization': `token ${repoInformation.token}`,
          };

          console.log(headers);

          const data = {
            name: repoInformation.name,
            body: repoInformation.body,
          };

          console.log(data);

          let result = '';

          try {
            result = await HTTP.call(method, url, { headers, data });
          } catch(e) {
            console.log(e);
          }

          return result;
        }

The response is below (@ server):

I20170224-12:38:18.216(11)? https://api.github.com/orgs/<my-org-name-here>/projects
I20170224-12:38:18.228(11)? { 'User-Agent': 'Meteor/1.0',
I20170224-12:38:18.228(11)?   Accept: 'application/vnd.github.inertia-preview+json',
I20170224-12:38:18.228(11)?   Authorization: 'token <my-awesome-token-here>' }
I20170224-12:38:18.229(11)? { name: 'Test Site', body: 'www.test.com' }
I20170224-12:38:19.380(11)? { [Error: failed [500] {"message":"Server Error","documentation_url":"https://developer.github.com/v3"}]
I20170224-12:38:19.381(11)?   response: 
I20170224-12:38:19.381(11)?    { statusCode: 500,
I20170224-12:38:19.381(11)?      content: '{"message":"Server Error","documentation_url":"https://developer.github.com/v3"}',
I20170224-12:38:19.382(11)?      headers: 
I20170224-12:38:19.382(11)?       { server: 'GitHub.com',
I20170224-12:38:19.384(11)?         date: 'Fri, 24 Feb 2017 01:38:19 GMT',
I20170224-12:38:19.385(11)?         'content-type': 'application/json; charset=utf-8',
I20170224-12:38:19.385(11)?         'content-length': '80',
I20170224-12:38:19.386(11)?         connection: 'close',
I20170224-12:38:19.386(11)?         status: '500 Internal Server Error',
I20170224-12:38:19.387(11)?         'x-ratelimit-limit': '5000',
I20170224-12:38:19.387(11)?         'x-ratelimit-remaining': '4992',
I20170224-12:38:19.387(11)?         'x-ratelimit-reset': '1487902439',
I20170224-12:38:19.388(11)?         'x-github-media-type': 'github.inertia-preview; format=json',
I20170224-12:38:19.388(11)?         'access-control-expose-headers': 'ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval',
I20170224-12:38:19.388(11)?         'access-control-allow-origin': '*',
I20170224-12:38:19.388(11)?         'content-security-policy': 'default-src \'none\'',
I20170224-12:38:19.389(11)?         'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
I20170224-12:38:19.390(11)?         'x-content-type-options': 'nosniff',
I20170224-12:38:19.390(11)?         'x-frame-options': 'deny',
I20170224-12:38:19.390(11)?         'x-xss-protection': '1; mode=block',
I20170224-12:38:19.391(11)?         'x-github-request-id': 'E4AC:767B:26E5BD:30FBDE:58AF8E8A' },
I20170224-12:38:19.391(11)?      data: 
I20170224-12:38:19.391(11)?       { message: 'Server Error',
I20170224-12:38:19.391(11)?         documentation_url: 'https://developer.github.com/v3' } } }

The problem is, (a) it should not be erroring above, and (b) it should not be creating the projects? In the below i tried it a few times before realized what was happening.

Any assistance would be appreciated. Thanks so much.

Tat