Electron-forge: Publishing to github fails due to deprecated options in @octokit/rest.js

Created on 23 Apr 2018  Â·  17Comments  Â·  Source: electron-userland/electron-forge

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

Please describe your issue:

Using v5.2.0, attempting to publish to github releases. Seems like the github api host (api.github.com) is undefined for some reason. Possibly an issue with octokit

Console output when you run electron-forge with the environment variable DEBUG=electron-forge:*. (Instructions on how to do so here). Please include the stack trace if one exists.

josh:gif-goat pixelfiend$ DEBUG=electron-forge:* electron-forge publish
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:lifecycle Process Started: Checking your system +0ms
  electron-forge:lifecycle Process Succeeded: Checking your system +1s
  electron-forge:runtime-config setting key: verbose to value: false +0ms
WARNING: DEBUG environment variable detected.  Progress indicators will be sent over electron-forge:lifecycle
  electron-forge:publish triggering make +0ms
  electron-forge:lifecycle Process Started: Resolving Forge Config +0ms
  electron-forge:project-resolver searching for project in: /Users/pixelfiend/workspace/gif-goat +0ms
  electron-forge:project-resolver electron-forge compatible package.json found in /Users/pixelfiend/workspace/gif-goat/package.json +1ms
  electron-forge:lifecycle Process Succeeded: Resolving Forge Config +8ms
  electron-forge:require-search searching [ '../makers/darwin/dmg.js',
  '../makers/generic/dmg.js',
  'electron-forge-maker-dmg',
  'dmg',
  '/Users/pixelfiend/workspace/gif-goat/dmg',
  '/Users/pixelfiend/workspace/gif-goat/node_modules/dmg',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/makers/darwin/dmg.js',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/makers/generic/dmg.js',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api/electron-forge-maker-dmg',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api/dmg',
  '/Users/pixelfiend/workspace/gif-goat/dmg',
  '/Users/pixelfiend/workspace/gif-goat/node_modules/dmg',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api/makers/darwin/dmg.js',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api/makers/generic/dmg.js',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api/node_modules/electron-forge-maker-dmg',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api/node_modules/dmg',
  '/Users/pixelfiend/workspace/gif-goat/dmg',
  '/Users/pixelfiend/workspace/gif-goat/node_modules/dmg' ] relative to /Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api +0ms
  electron-forge:require-search testing ../makers/darwin/dmg.js +6ms
We need to package your application before we can make it
  electron-forge:lifecycle Process Started: Preparing to Package Application for arch: x64 +15ms
  electron-forge:project-resolver searching for project in: /Users/pixelfiend/workspace/gif-goat +20ms
  electron-forge:project-resolver electron-forge compatible package.json found in /Users/pixelfiend/workspace/gif-goat/package.json +1ms
  electron-forge:hook could not find hook: generateAssets +0ms
  electron-forge:hook could not find hook: prePackage +0ms
  electron-forge:packager packaging with options { asar: false,
  overwrite: true,
  packageManager: 'npm',
  icon: './src/assets/imgs/icon-1024.png',
  afterCopy: [ [Function] ],
  afterExtract: [ [Function] ],
  afterPrune: [ [Function] ],
  dir: '/Users/pixelfiend/workspace/gif-goat',
  arch: 'x64',
  platform: 'darwin',
  out: '/Users/pixelfiend/workspace/gif-goat/out',
  electronVersion: '1.8.4',
  quiet: true } +0ms
  electron-forge:lifecycle Process Succeeded: Preparing to Package Application for arch: x64 +50s
  electron-forge:lifecycle Process Started: Compiling Application +2ms
  electron-forge:lifecycle Process Succeeded: Compiling Application +2s
  electron-forge:lifecycle Process Started: Preparing native dependencies +13s
  electron-forge:lifecycle Process Succeeded: Preparing native dependencies +737ms
  electron-forge:lifecycle Process Started: Packaging Application +1ms
  electron-forge:hook could not find hook: postPackage +1m
  electron-forge:lifecycle Process Succeeded: Packaging Application +12s
Making for the following targets:
  electron-forge:hook could not find hook: preMake +3ms
  electron-forge:lifecycle Process Started: Making for target: dmg - On platform: darwin - For arch: x64 +6ms
  electron-forge:lifecycle Process Succeeded: Making for target: dmg - On platform: darwin - For arch: x64 +22s
  electron-forge:hook could not find hook: postMake +22s
  electron-forge:project-resolver searching for project in: /Users/pixelfiend/workspace/gif-goat +2m
  electron-forge:project-resolver electron-forge compatible package.json found in /Users/pixelfiend/workspace/gif-goat/package.json +1ms
  electron-forge:lifecycle Process Started: Resolving publish target: github +2ms
  electron-forge:require-search searching [ '../publishers/github.js',
  'electron-forge-publisher-github',
  'github',
  '/Users/pixelfiend/workspace/gif-goat/github',
  '/Users/pixelfiend/workspace/gif-goat/node_modules/github',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/publishers/github.js',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api/electron-forge-publisher-github',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api/github',
  '/Users/pixelfiend/workspace/gif-goat/github',
  '/Users/pixelfiend/workspace/gif-goat/node_modules/github',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api/publishers/github.js',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api/node_modules/electron-forge-publisher-github',
  '/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api/node_modules/github',
  '/Users/pixelfiend/workspace/gif-goat/github',
  '/Users/pixelfiend/workspace/gif-goat/node_modules/github' ] relative to /Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/dist/api +2m
  electron-forge:require-search testing ../publishers/github.js +4ms
  electron-forge:lifecycle Process Succeeded: Resolving publish target: github +262ms
  electron-forge:lifecycle Process Started: Searching for target release +3ms
DEPRECATED: protocol option is no longer supported
  electron-forge:lifecycle Process Failed: Searching for target release +116ms

An unhandled error has occurred inside Forge:
request to https://undefined/repos/positlabs/gif-goat/releases?per_page=100 failed, reason: getaddrinfo ENOTFOUND undefined undefined:443
HttpError: request to https://undefined/repos/positlabs/gif-goat/releases?per_page=100 failed, reason: getaddrinfo ENOTFOUND undefined undefined:443
    at fetch.then.then.catch.error (/Users/pixelfiend/.nvm/versions/node/v6.14.1/lib/node_modules/electron-forge/node_modules/@octokit/rest/lib/request/request.js:88:13)
    at process._tickCallback (internal/process/next_tick.js:109:7)

What command line arguments are you passing?

electron-forge publish --target=github --platform=darwin

What does your config.forge data in package.json look like?

  "config": {
    "forge": {
      "make_targets": {
        "darwin": [
          "dmg"
        ]
      },
      "electronPackagerConfig": {
        "packageManager": "npm",
        "icon": "./src/assets/imgs/icon-1024.png"
      },
      "github_repository": {
        "owner": "positlabs",
        "name": "gif-goat"
      }
    }
  }

Please provide either a failing minimal testcase (with a link to the code) or detailed steps to
reproduce your problem. Using electron-forge init is a good starting point, if that is not the
source of your problem.

https://github.com/positlabs/gif-goat

Most helpful comment

All 17 comments

anyone have a workaround here? this seems to have forced my development to a grinding halt

The workaround is to manually upload releases to github. Not the end of the world, but not ideal

@positlabs cool. i have been doing this in the meantime. thanks!

@benjtinsley @positlabs If you delete your node_modules directory and re-install it does it start working âť“

@MarshallOfSound thanks for the suggestion, unfortunately that does not fix.

@positlabs may be onto something by suggesting that it is a problem within octokit, or possibly electron-forge using an outdated version of octokit. without having much knowledge on typescript or octokit/rest.js it looks like the use of it in the electron-forge publish package differs from the advertised api on the rest.js repo.

I found it, octokit/rest.js "deprecated" config options in a minor release: https://github.com/octokit/rest.js/commit/96b9fc65616d062c9b422c941b0e87122721e4a1

I don't think their deprecations work too well.

@malept Should ping the folks on octokit, that's something they need to be aware of and revert till a major release

@MarshallOfSound once I make the PR for master, I'll see if I can make a minimal testcase for them.

Reopening since the 5.x PR isn't merged yet (it's being weird in CI)

While we're waiting for 5.x CI to behave itself, you should be able to work around this by adding this to forge config:

config: {
  forge: {
    github_repository: {
      options: {
        protocol: undefined
      }
    }
  }
}

I guess I need to be clearer:

Workaround for Electron Forge 5.2.0: follow the directions in my previous comment.

  • If you use github.com: you don't need to do anything else.
  • If you use GitHub Enterprise, set config.forge.github_repository.options.baseUrl.

For Electron Forge 5.2.1 (which is not released yet due to issues with CI):

  • If you use github.com: you don't need to do anything special.
  • If you use GitHub Enterprise, set config.forge.github_repository.options.baseUrl.

if not set protocol and host i will get undefined error。 if set protocol is undefined always get undefined error。

This is what happens when you set protocol to undefined: https://runkit.com/malept/octokit-undefined-protocol

api.github.com is the default host.

Merged / fixed now 👍

Was this page helpful?
0 / 5 - 0 ratings