arabold/serverless-sentry-plugin

Create release failing on v2.0.0

dryror opened this issue · 2 comments

Just testing out updating one of my projects to use the new v2.0.0 versions of your plugin and lib and have run into an error during deployment.

Looking into the code, it seems to be failing here in the compiled code:

return [4 /*yield*/, superagent_1.default
    .post("https://sentry.io/api/0/organizations/" + organization + "/releases/")
    .set("Authorization", "Bearer " + this.sentry.authToken)
    .send(payload)];

When I change superagent_1.default to just superagent_1 (remove .default) from the code, the deployment works. I suspect its just an issue with the build process, but I'm not familiar with typescript so that's just a guess.

The full stacktrace is:

Error: Sentry: Error uploading release - TypeError: Cannot read property 'post' of undefined
    at SentryPlugin.<anonymous> (/my-project/node_modules/serverless-sentry/dist/index.js:442:31)
    at step (/my-project/node_modules/serverless-sentry/dist/index.js:44:23)
    at Object.next (/my-project/node_modules/serverless-sentry/dist/index.js:25:53)
    at /my-project/node_modules/serverless-sentry/dist/index.js:19:71
    at new Promise (<anonymous>)
    at __awaiter (/my-project/node_modules/serverless-sentry/dist/index.js:15:12)
    at SentryPlugin.createSentryRelease (/my-project/node_modules/serverless-sentry/dist/index.js:408:16)
    at SentryPlugin.<anonymous> (/my-project/node_modules/serverless-sentry/dist/index.js:100:59)
    at step (/my-project/node_modules/serverless-sentry/dist/index.js:44:23)
    at Object.next (/my-project/node_modules/serverless-sentry/dist/index.js:25:53)
    at /my-project/node_modules/serverless-sentry/dist/index.js:19:71
    at new Promise (<anonymous>)
    at __awaiter (/my-project/node_modules/serverless-sentry/dist/index.js:15:12)
    at Object.after:deploy:deploy [as hook] (/my-project/node_modules/serverless-sentry/dist/index.js:97:57)
    at /my-project/node_modules/serverless/lib/classes/PluginManager.js:490:55
    at tryCatcher (/my-project/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
    at Object.gotValue (/my-project/node_modules/serverless/node_modules/bluebird/js/release/reduce.js:168:18)
    at Object.gotAccum (/my-project/node_modules/serverless/node_modules/bluebird/js/release/reduce.js:155:25)
    at Object.tryCatcher (/my-project/node_modules/serverless/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/my-project/node_modules/serverless/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/my-project/node_modules/serverless/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/my-project/node_modules/serverless/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/my-project/node_modules/serverless/node_modules/bluebird/js/release/promise.js:729:18)
    at _drainQueueStep (/my-project/node_modules/serverless/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/my-project/node_modules/serverless/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/my-project/node_modules/serverless/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues (/my-project/node_modules/serverless/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:456:21)
    at process.topLevelDomainCallback (domain.js:137:15)

After doing a quick search, it might be as simple as changing

import request from "superagent";

to

import * as request from "superagent";

I'll see if I can get it up and running locally to test.

v2.0.1 is released