Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[s3] publish fails with "callback called twice" #479

Closed
3 tasks done
onassar opened this issue Apr 13, 2018 · 2 comments · Fixed by #1318
Closed
3 tasks done

[s3] publish fails with "callback called twice" #479

onassar opened this issue Apr 13, 2018 · 2 comments · Fixed by #1318

Comments

@onassar
Copy link

onassar commented Apr 13, 2018

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Please describe your issue:

When publishing to S3, I sometimes (20-40% of the time) receive an error.
Here's the log:

✔ Checking your system
✔ Resolving Forge Config
We need to package your application before we can make it
✔ Preparing to Package Application for arch: x64
✔ Compiling Application
✔ Preparing native dependencies
✔ Packaging Application
Making for the following targets:
✔ Making for target: dmg - On platform: darwin - For arch: x64
✔ Making for target: zip - On platform: darwin - For arch: x64
✔ Resolving publish target: s3
⠙ Uploading Artifacts 1/2
An unhandled exception has occurred inside Forge:
callback called twice
Error: callback called twice
    at onCb (/usr/local/lib/node_modules/electron-forge/node_modules/pend/index.js:36:23)
    at Response.<anonymous> (/usr/local/lib/node_modules/electron-forge/node_modules/s3/lib/index.js:303:11)
    at Request.<anonymous> (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/request.js:364:18)
    at Request.callListeners (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at Request.emit (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/request.js:685:12)
    at Request.callListeners (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
    at Request.emit (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/electron-forge/node_modules/aws-sdk/lib/state_machine.js:14:12)

Screenshot: https://i.imgur.com/ZE8qh4I.png

Command: electron-forge publish --platform=darwin --target=s3

It's unreliable; can't always reproduce.

package.json

{
  "name": "Name",
  "productName": "Name",
  "version": "1.0.5",
  "description": "Description",
  "main": "src/js/main.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish",
    "lint": "eslint src --color"
  },
  "keywords": [],
  "author": "Author",
  "license": "MIT",
  "config": {
    "forge": "src/js/config/forge.js"
  },
  "dependencies": {
    "deepmerge": "^2.1.0",
    "electron-compile": "^6.4.2",
    "electron-log": "^2.2.14",
    "electron-squirrel-startup": "^1.0.0",
    "node-localstorage": "^1.3.0",
    "uberproto": "^1.2.0"
  },
  "devDependencies": {
    "babel-plugin-transform-async-to-generator": "^6.24.1",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.24.1",
    "electron-forge": "^5.1.1",
    "electron-prebuilt-compile": "1.8.2",
    "eslint": "^3.19.0",
    "eslint-config-airbnb": "^15.1.0",
    "eslint-plugin-import": "^2.9.0",
    "eslint-plugin-jsx-a11y": "^5.1.1",
    "eslint-plugin-react": "^7.7.0"
  }
}

forge.js

// Aws config path
var fs = require('fs'),
    awsPath = __dirname + '/aws.json',
    aws = {
        "auth": {
            "key": "***",
            "secret": "***"
        },
        "s3": {
            "bucketName": "files.s3bucket.com.local"
        }
    };
if (fs.existsSync(awsPath) === true) {
    var content = fs.readFileSync(awsPath, 'utf8');
    aws = JSON.parse(content);
}

// Let's do this
module.exports = {
  "make_targets": {
    "darwin": [
      "dmg",
      "zip"
    ],
    "linux": [
      "deb",
      "rpm"
    ],
    "win32": [
      "squirrel"
    ]
  },
  "electronPackagerConfig": {
    "asar": true,
    "ignore": [
      "/src\/images\/icon\.1024x1024\.dev\.png",
      "/src\/images\/icon\.1024x1024\.local\.png",
      "/src\/images\/icon\.1024x1024\.prod\.png",
      "/src\/js\/config\/aws\.json",
      "/src\/js\/config\/forge\.js"
    ],
    "appCategoryType": "public.app-category.graphics-design",
    "appBundleId": "com.anchor.macOS.appName",
    "osxSign": {
      "identity": "Mac Developer: Developer Name (KEY)"
    },
    "packageManager": "npm",
    "icon": "src/images/icon.icns"
  },
  "electronWinstallerConfig": {
    "name": "Name"
  },
  "electronInstallerDMG": {
    "background": "src/images/background.png",
    "icon": "src/images/icon.icns"
  },
  "electronInstallerDebian": {},
  "electronInstallerRedhat": {},
  "s3": {
    "accessKeyId": aws.auth.key,
    "secretAccessKey": aws.auth.secret,
    "bucket": aws.s3.bucketName,
    "folder": "releases",
    "public": true
  },
  "windowsStoreConfig": {
    "packageName": "",
    "name": "Name"
  }
};
@justinneff
Copy link

Does anyone know what causes this error? I am getting the same error only on Windows instead of OSX.

@MarshallOfSound
Copy link
Member

Current theory is the s3 module we use is broken 😢 We could fix this probably by moving to directly use aws-sdk

@malept malept mentioned this issue Dec 11, 2018
22 tasks
@malept malept changed the title publish fails with "callback called twice" [s3] publish fails with "callback called twice" Sep 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants