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

Empty config in @electron-forge/publisher-nucleus@6.0.0-beta.22 #541

Closed
dsheiko opened this issue Jul 19, 2018 · 9 comments
Closed

Empty config in @electron-forge/publisher-nucleus@6.0.0-beta.22 #541

dsheiko opened this issue Jul 19, 2018 · 9 comments

Comments

@dsheiko
Copy link

dsheiko commented Jul 19, 2018

If you check config object assigned in https://github.com/electron-userland/electron-forge/blob/e55a9d5beb666a944ae730e6ed0a2ba6b5594c93/packages/publisher/nucleus/src/PublisherNucleus.ts#L35
it's empty (regardless of how config declared as manifest block or a separate file) and therefore the fetch function https://github.com/electron-userland/electron-forge/blob/e55a9d5beb666a944ae730e6ed0a2ba6b5594c93/packages/publisher/nucleus/src/PublisherNucleus.ts#L57 receives empty config.host and throws an error (Absolute URL required).

As a dirty workaround I had to do the following, given I have the only publisher:

 async publish({ makeResults, forgeConfig }: PublisherOptions) {
    const config = forgeConfig.publishers[0].config
...

So it publishes correctly to Nucleus server

My env: Windows 10, Node.js 10.4.1

package.json

{
  "name": "test",
  "productName": "test",
  "version": "1.0.0",
  "description": "My Electron application description",
  "main": "src/index.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish --target=@electron-forge/publisher-nucleus",
    "lint": "echo \"No linting configured\""
  },
  "keywords": [],
  "author": "dmitry",
  "license": "MIT",
  "config": {
    "forge": "./forge.config.js"
  },
  "dependencies": {
    "@electron-forge/publisher-nucleus": "^6.0.0-beta.22",
    "electron-squirrel-startup": "^1.0.0"
  },
  "devDependencies": {
    "@electron-forge/cli": "^6.0.0-beta.22",
    "@electron-forge/maker-deb": "^6.0.0-beta.22",
    "@electron-forge/maker-rpm": "^6.0.0-beta.22",
    "@electron-forge/maker-squirrel": "^6.0.0-beta.22",
    "@electron-forge/maker-zip": "^6.0.0-beta.22",
    "electron": "2.0.5"
  }
}

forge.config.js

module.exports = {
  "packagerConfig": {},
      "publishers": [
        {
          "name": "@electron-forge/publisher-nucleus",
          "config": {
            "host": "http://localhost:3030",
            "appId": "2",
            "channelId": "5542496b41ba12ab15a31862d78088f4",
            "token": "TOKEN"
          }
        }
      ],
      "makers": [
        {
          "name": "@electron-forge/maker-squirrel",
          "config": {
            "name": "test"
          }
        },
        {
          "name": "@electron-forge/maker-zip",
          "platforms": [
            "darwin"
          ]
        },
        {
          "name": "@electron-forge/maker-deb",
          "config": {}
        },
        {
          "name": "@electron-forge/maker-rpm",
          "config": {}
        }
      ]
}
@MarshallOfSound
Copy link
Member

Can you verify this is still an issue on beta.25

@dsheiko
Copy link
Author

dsheiko commented Jul 19, 2018

Well, I'm forcing 25:

npm i @electron-forge/publisher-nucleus@6.0.0-beta.25

in node_modules\@electron-forge\publisher-nucleus\package.json

"version": "6.0.0-beta.25" 

and it's still empty
node_modules@electron-forge\publisher-nucleus\dist\PublisherNucleus.js

return _asyncToGenerator(function* () {
      const config = _this.config;
      console.log( "CONFIG", config );

Now firing npm run publish:
-> CONFIG {}

An unhandled error has occurred inside Forge:
Only absolute URLs are supported
TypeError: Only absolute URLs are supported

@MarshallOfSound
Copy link
Member

@dsheiko Can you post your forge configuration

@dsheiko
Copy link
Author

dsheiko commented Jul 19, 2018

It's above in the very first post forge.config.js
The only thing changed is 6.0.0-beta.22 in package.json changed to 6.0.0-beta.25

@MarshallOfSound
Copy link
Member

I can't reproduce this on beta.25 locally. My package.json looks like this

{
  "name": "test-nucleus",
  "productName": "test-nucleus",
  "version": "1.0.0",
  "description": "My Electron application description",
  "main": "src/index.js",
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make",
    "publish": "electron-forge publish",
    "lint": "echo \"No linting configured\""
  },
  "keywords": [],
  "author": "sattard",
  "license": "MIT",
  "config": {
    "forge": {
      "packagerConfig": {},
      "makers": [
        {
          "name": "@electron-forge/maker-squirrel",
          "config": {
            "name": "test_nucleus"
          }
        },
        {
          "name": "@electron-forge/maker-zip",
          "platforms": [
            "darwin"
          ]
        },
        {
          "name": "@electron-forge/maker-deb",
          "config": {}
        },
        {
          "name": "@electron-forge/maker-rpm",
          "config": {}
        }
      ],
      "publishers": [
        {
          "name": "@electron-forge/publisher-nucleus",
          "config": {
            "host": "http://localhost:3030",
            "appId": "2",
            "channelId": "5542496b41ba12ab15a31862d78088f4",
            "token": "TOKEN"
          }
        }
      ]
    }
  },
  "dependencies": {
    "electron-squirrel-startup": "^1.0.0"
  },
  "devDependencies": {
    "@electron-forge/cli": "^6.0.0-beta.25",
    "@electron-forge/maker-deb": "^6.0.0-beta.25",
    "@electron-forge/maker-rpm": "^6.0.0-beta.25",
    "@electron-forge/maker-squirrel": "^6.0.0-beta.25",
    "@electron-forge/maker-zip": "^6.0.0-beta.25",
    "@electron-forge/publisher-nucleus": "^6.0.0-beta.25",
    "electron": "2.0.5"
  }
}

And it works as expected and loads that config. Can you post more information about your environment, in particular your node version

@dsheiko
Copy link
Author

dsheiko commented Jul 20, 2018

I did it in the very first post
My env: Windows 10, Node.js 10.4.1
I asked a college to try on Node 6 and Node 8 in both cases the same results

Here my project https://file.io/FrXNWG
You just need to run

npm install
npm run publish

You are expected to have:

√ Checking your system                                                                                    
√ Resolving Forge Config                                                                                  
We need to package your application before we can make it                                                 
√ Preparing to Package Application for arch: x64                                                          
√ Preparing native dependencies                                                                           
√ Packaging Application                                                                                   
Making for the following targets: squirrel                                                                
√ Making for target: squirrel - On platform: win32 - For arch: x64                                        
√ Resolving publish target: @electron-forge/publisher-nucleus                                             
× Uploading result (1/1)                                                                                  
                                                                                                          
An unhandled error has occurred inside Forge:                                                             
Only absolute URLs are supported                                                                          
TypeError: Only absolute URLs are supported                                                               
    at getNodeRequestOptions (D:\TEST\test-nucleus\node_modules\node-fetch\lib\index.js:1284:9)           
    at D:\TEST\test-nucleus\node_modules\node-fetch\lib\index.js:1370:19                                  
    at new Promise (<anonymous>)                                                                          
    at fetch (D:\TEST\test-nucleus\node_modules\node-fetch\lib\index.js:1367:9)                           
    at D:\TEST\test-nucleus\node_modules\@electron-forge\publisher-nucleus\src\PublisherNucleus.ts:57:32  

As I previously explained, that happens because config object is empty

P.S. Maybe it happens because I explicitly force the target like

"publish": "electron-forge publish --target=@electron-forge/publisher-nucleus"

@MarshallOfSound
Copy link
Member

@dsheiko That'll be it

"publish": "electron-forge publish --target=@electron-forge/publisher-nucleus"

We probably aren't resolving the config correctly for those cases, for now just run electron-forge publish. I'll look at fixing that case 👍

@vintprox
Copy link
Contributor

vintprox commented Jul 24, 2018

@malept
Copy link
Member

malept commented Jul 24, 2018

@vintproykt per the docs, host includes the protocol.

dsanders11 pushed a commit that referenced this issue Jan 14, 2023
* build: update Electron releases JSON

* build: update Electron releases JSON

Co-authored-by: Electron Bot <electron-bot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants