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.

latest.yml is completely empty when uploaded to S3 bucket

See original GitHub issue
  • electron-builder version: 17.10.0
  • electron-updater version: 1.16.0
  • Target: Windows 7 64-bit

I’ve tried configuring electron-builder to publish releases of my Electron app to a newly-created S3 bucket:

{
  "scripts": {
    "release:win": "npm run build && build --win --x64 -p always",
  },
  "build": {
    "publish": [
      {
        "provider": "s3",
        "bucket": "<company_bucket_name>",
        "path": "<product_name>"
      }
    ],
   }
}

I see these logs as I’m running the build:

No native production dependencies
Packaging for win32 x64 using electron 1.7.1 to bin\win-unpacked
Building NSIS installer
  Packaging NSIS installer for arch x64
Publishing to S3 (bucket: <company_bucket_name>)
[====================] 100% 0.0s | latest.yml to S3
[====================] 100% 0.0s | <product> Setup 0.1.0.exe to S3

After the build is complete, I can see both files in the expected location in the S3 bucket. The executable looks about the right size, and I can download it and run it successfully.

However, the uploaded version of latest.yml right next to it is 0 bytes big (completely empty). When I launch my installed application, I see these logs:

[2017-05-24 13:58:17:0764] [info] Created main window
[2017-05-24 13:58:17:0812] [info] Checking for update
[2017-05-24 13:58:20:0044] [error] Error: TypeError: Cannot read property 'sha2' of undefined

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
TAGCcommented, May 25, 2017

I’ve implemented a workaround until this issue is resolved:

package.json

{
  "scripts": {
    "republish-latest": "node --trace-warnings -r babel-register ./utils/republish-latest.js",
    "release:win": "npm run build && build --win --x64 -p always && npm run republish-latest",
  }
}

utils/republish-latest.js

/**
 * Temporary script until electron-builder#1582 is resolved (https://github.com/electron-userland/electron-builder/issues/1582).
 */
import * as path from 'path'
import { S3 } from 'aws-sdk'
import { readFileSync } from 'fs'

const BUCKET = '<company>-releases'
const KEY = '<product>/latest.yml'
const LATEST_YML_PATH = path.resolve(__dirname, '../bin/latest.yml')

const s3Options = {
  signatureVersion: 'v4'
}

const putOptions = {
  Bucket: BUCKET,
  Key: KEY,
  ACL: 'public-read',
  Body: readFileSync(LATEST_YML_PATH)
}

const s3 = new S3(s3Options)

function callback (err, data) {
  if (err) {
    console.error('Error occurred while trying to publish latest.yml\n', err)
  } else {
    console.log(data)
    console.info(`Successfully published latest.yml to ${BUCKET}`)
  }
}

s3.putObject(putOptions, callback)
0reactions
develarcommented, Jun 3, 2017

electron-publisher-s3 18.4.1 published.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve errors uploading data to or downloading data from ...
To run the SELECT INTO OUTFILE S3 or LOAD DATA FROM S3 commands using Amazon Aurora, follow the steps below: 1. Create an...
Read more >
AWS S3: The bucket you are attempting to access must be ...
However, I am getting the following error: The bucket you are attempting to access must be addressed using the specified endpoint. Please send...
Read more >
How To Upload File to S3 with the AWS CLI
An AWS S3 bucket. You can use an existing bucket if you'd prefer. Still, it is recommended to create an empty bucket instead....
Read more >
How to Upload Files to Amazon S3 in Spring Boot - Section.io
Name the bucket as spring-amazon-storage and leave all other settings ... isEmpty()) { throw new IllegalStateException("Cannot upload empty ...
Read more >
How can I get the size of an Amazon S3 bucket? - Server Fault
Important: You must specify both StorageType and BucketName in the dimensions argument otherwise you will get no results. All you need to change...
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