question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue setting S3 publish provider via Programmatic Access

See original GitHub issue

This is probably a dumb question, so I’m sure it’ll get responded to quickly, but, just in case, I donated (video proof below)!

https://www.useloom.com/share/1f9a77069e9e4f01a03b16ae8748b031

  • Version: 20.20.4

  • electron-updater Version: 3.0.3

  • Target: Windows (NSIS) and Mac (default - Zip + DMG)

When trying to publish the package to S3, I’m running into issues where the configuration seems to be wrong. This is the config I’m using (programmatic access):

await builder.build({
  mac:    ['default'],
  win:    ['nsis'],
  config: {
    appId:        APP_BUNDLE_ID,
    buildVersion: appVersion,
    directories:  {
      app:    './',
      output: './builds'
    },
    icon:        path.join(__dirname, './assets/application-icons/salmon-app.icns'),
    productName: name
  },
  publish: {
    provider: 's3',
    acl:      'public-read',
    bucket:   bucketName,
    region:   'us-west-1'
  }
});

Below is the error I’m getting. I’m not sure what I’m not setting. When I try to change the mac and win keys to any other data type (tried doing { win: { target: 'nsis', publish: ['s3'] } }), I get an error about the value not being iteratable. I can’t make out what I’m doing wrong based on the docs.

error packaging app:  { Error: GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"
    at new GitHubPublisher (/Users/vinay/Code/desktop/node_modules/electron-publish/src/gitHubPublisher.ts:47:15)
    at createPublisher (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/out/publish/PublishManager.js:575:14)
    at PublishManager.getOrCreatePublisher (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/publish/PublishManager.ts:171:9)
    at PublishManager.scheduleUpload (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/publish/PublishManager.ts:111:7)
    at EventEmitter.PublishManager.packager.artifactCreated.event (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/publish/PublishManager.ts:102:11)
    at emitOne (events.js:121:20)
    at EventEmitter.emit (events.js:211:7)
    at Packager.dispatchArtifactCreated (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/packager.ts:240:23)
    at /Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/publish/updateInfoBuilder.ts:231:19
    at Generator.next (<anonymous>)
    at /Users/vinay/Code/desktop/node_modules/graceful-fs/graceful-fs.js:99:16
    at /Users/vinay/Code/desktop/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at writeOldMacInfo (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/out/publish/updateInfoBuilder.js:161:18)
    at /Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/publish/updateInfoBuilder.ts:130:11
From previous event:
    at createUpdateInfoTasks (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/out/publish/updateInfoBuilder.js:289:18)
    at /Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/publish/PublishManager.ts:159:6
From previous event:
    at PublishManager.artifactCreated (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/publish/PublishManager.ts:161:5)
    at EventEmitter.PublishManager.packager.artifactCreated.event (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/publish/PublishManager.ts:96:36)
    at emitOne (events.js:121:20)
    at EventEmitter.emit (events.js:211:7)
    at Packager.dispatchArtifactCreated (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/packager.ts:240:23)
    at /Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/targets/ArchiveTarget.ts:43:19
    at Generator.next (<anonymous>)
From previous event:
    at ArchiveTarget.build (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/targets/ArchiveTarget.ts:14:44)
    at Function.buildAsyncTargets (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/platformPackager.ts:139:36)
    at MacPackager.packageInDistributableFormat (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/platformPackager.ts:118:24)
    at nonMasPromise.then.then (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/macPackager.ts:90:26)
    at bound (domain.js:301:14)
    at runBound (domain.js:314:12)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
    at /Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/macPackager.ts:90:10
    at Generator.next (<anonymous>)
From previous event:
    at MacPackager.pack (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/macPackager.ts:80:95)
    at /Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/packager.ts:369:24
    at Generator.next (<anonymous>)
    at xfs.stat (/Users/vinay/Code/desktop/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at /Users/vinay/Code/desktop/node_modules/graceful-fs/polyfills.js:287:18
    at FSReqWrap.oncomplete (fs.js:153:5)
From previous event:
    at Packager.doBuild (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/packager.ts:337:39)
    at /Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/packager.ts:313:52
    at Generator.next (<anonymous>)
    at /Users/vinay/Code/desktop/node_modules/graceful-fs/graceful-fs.js:99:16
    at /Users/vinay/Code/desktop/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at Packager._build (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/packager.ts:290:133)
    at /Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/packager.ts:286:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
    at Packager.build (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/packager.ts:243:14)
    at /Users/vinay/Code/desktop/node_modules/electron-builder-lib/src/index.ts:52:40
    at Generator.next (<anonymous>)
From previous event:
    at build (/Users/vinay/Code/desktop/node_modules/electron-builder-lib/out/index.js:220:17)
    at Object.build (/Users/vinay/Code/desktop/node_modules/electron-builder/src/builder.ts:224:10)
    at _callee$ (/Users/vinay/Code/desktop/gulpfile.babel.js:69:28)
    at tryCatch (/Users/vinay/Code/desktop/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/Users/vinay/Code/desktop/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/vinay/Code/desktop/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/Users/vinay/Code/desktop/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /Users/vinay/Code/desktop/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
    at <anonymous> code: 'ERR_ELECTRON_BUILDER_INVALID_CONFIGURATION' }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
develarcommented, Jul 20, 2018

Set publish: “always” in the options object.

You can use config file as js — electron-builder.js You are not forced to use yaml or json.

1reaction
vhmthcommented, Jul 20, 2018

@develar thank you! I did that and now the error is gone, but nothing is publishing. I can verify that my ~/.aws/credentials file exists but can’t seem to figure out why the publish step isn’t triggering. Is it perhaps because I haven’t passed in always as a publish option? I’m not sure where to put that in the programmatic API if that’s the case. I’ve bumped the version in package.json.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allows read and write access to objects in an S3 Bucket ...
Use this IAM policy to provide access to the AWS Management Console and read and write access to objects in an Amazon S3...
Read more >
aws_s3_bucket_notification | Resources | hashicorp/aws
Manages a S3 Bucket Notification Configuration. For additional information, see the Configuring S3 Event Notifications section in the Amazon S3 Developer ...
Read more >
Provide cross-account access to objects in Amazon S3 buckets
Use resource-based bucket policies to manage cross-account access control and audit the S3 object's permissions. If you apply a bucket policy at the...
Read more >
How to Set up Amazon S3 Upload Provider Plugin for ... - Strapi
You will first set up and configure an S3 storage bucket for your app. Then, you'll create a Strapi App using one of...
Read more >
Configuring Secure Access to Amazon S3
Configure an AWS IAM user with the required permissions to access your S3 bucket. This one-time setup involves establishing access permissions on a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found