3

Eventbrite has an official sdk for their API. According to docs, installing and using should be easy:

const eventbrite = require('eventbrite');

// Create configured Eventbrite SDK
const sdk = eventbrite({token: 'OATH_TOKEN_HERE'});

sdk.request('/users/me').then(res => {
    // handle response data
});

However this does not work, I get an error "eventbrite is not a function" when trying to crate the sdk object. In fact, if I log what's in require('eventbrite') this is all I get:

const eventbrite = require('eventbrite');
console.log(JSON.stringify(eventbrite));
// {
//   "PAGE_KEY": "page",
//   "CONTINUATION_KEY": "continuation"
// }

I have probably got something really wrong here, is there an extra step I need to take after installing via npm?

Felipe Vignon
  • 451
  • 3
  • 9

1 Answers1

5

I figured it out, for this to work you gotta do:

const eventbrite = require('eventbrite').default;

I figure this has something to do with the way Node is managing requires in later versions (10, in my case).

Felipe Vignon
  • 451
  • 3
  • 9