eventOneHQ / apkup

🚀 Publish APKs to Google Play directly from the terminal
https://oss.eventone.page/apkup
MIT License
36 stars 12 forks source link

Cannot set property 'client' of undefined #13

Closed hrecho closed 4 years ago

hrecho commented 4 years ago
TypeError: Cannot set property 'client' of undefined
    at Apkup (c:\_...\node_modules\apkup\dist\index.js:65:21)

my gulp task

    var deployData = require('./.deployData.json'); 
    const { Apkup } = require('apkup');
    const publisher = Apkup({
        client_email: deployData.clientEmail,
        private_key: deployData.privateKey
    });
...

i am 100% sure my auth is correct, as i was using the playup before and its still working
apkup its not, its giving me this error while creating the publisher

nprail commented 4 years ago

This looks like the same issue as #11. apkup's API is a little different than playup.

You basically just have to create a new instance of the Apkup class like so:

    var deployData = require('./.deployData.json'); 
    const { Apkup } = require('apkup');
    // notice the added `new` 
    const publisher = new Apkup({
        client_email: deployData.clientEmail,
        private_key: deployData.privateKey
    });
...

Essentially:

// correct
const apkup = new Apkup({})

// incorrect
const apkup = Apkup({})
hrecho commented 4 years ago

how do i send you a beer my friend?

nprail commented 4 years ago

@hrecho I am glad to help! Considering that you aren't the first person to make that mistake, maybe I should add some documentation that explicitly makes it clear that, while apkup is a fork of playup, it has changed significantly internally and has a slightly different API.

If you really want to, I love some coffee :) https://ko-fi.com/nprail