electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

publish does not work with generic provider

Open beliaev-maksim opened this issue 3 years ago • 15 comments

  • Electron-Builder Version: 22.14.5
  • Node Version: v14.15.1
  • Electron Version: 11.0.1
  • Electron Type (current, beta, nightly):
  • Target: NSIS Winx64

When provider is set to generic and following macro is invoked electron-builder build --win --x64 --publish always electron builder does not emit any request to the web server

Provider looks to be configured correctly, since app is trying to get updates from the server when launched:

"publish": [
      {
        "provider": "generic",
        "url": "http://127.0.0.1:8000/api/apps/My First App"
      }
    ],

[13/Dec/2021 10:46:37] "GET /api/apps/My%20First%20App/beta.yml?noCache=1fmpivgae HTTP/1.1" 200 448

beliaev-maksim avatar Dec 13 '21 09:12 beliaev-maksim

Your upload url has whitespaces. Is that intentional?

mmaietta avatar Dec 20 '21 22:12 mmaietta

@mmaietta I do not think that plays a role, electron-builder treats URL with spaces well and provides percent encoding. That works good with updating of the app

but just for sanity check I did replace a URL by http://127.0.0.1:8000/api/apps/My and still do not see any incoming request to the server when try to publish

beliaev-maksim avatar Dec 20 '21 22:12 beliaev-maksim

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Apr 16 '22 15:04 stale[bot]

I still think it is an issue

beliaev-maksim avatar Apr 18 '22 14:04 beliaev-maksim

Does it publish when you run electron-builder build -w --publish always ?

Can you provide a minimum repro repo for this? Such as using electron-quick-start app? And include some way to run a local server for generic publishing. I don't have a setup to repro this with.

mmaietta avatar Apr 18 '22 15:04 mmaietta

@mmaietta assuming you have python on your machine

install flask and start the server

git clone https://github.com/beliaev-maksim/repro.git
cd repro/server
python -m pip install flask
flask run

now electron:

cd repro
npm install
electron-builder build -w --publish always

you will see that server does not receive any request on publish however, if you open electron app, you will see, that server got a request for latest.yml but failed

beliaev-maksim avatar Apr 19 '22 14:04 beliaev-maksim

Hi, can confirm I see this same behavior with electron-builder v23.0.3.

No errors reported when using build -w --publish always args, but no assets actually get published. Looks as though a "generic" provider just gets ignored.

rericg avatar Apr 27 '22 14:04 rericg

electron-builder seems to reject 'generic' provider once I upgraded electron-builder to v23.0.3

Previous and working version: v22.11.7

My publish configuration

"build": {
 ....
 "publish": {
      "provider": "generic",
      "url": "http://192.168.121.124:8888/downloads",
      "generateUpdatesFilesForAllChannels": true
    }
}

Build error.

Invalid configuration object. electron-builder 23.0.3 has been initialized using a configuration object that does not match the API schema.
 - configuration.publish should be one of these:
   object { provider, channel?, host?, owner?, private?, protocol?, publishAutoUpdate?, publisherName?, releaseType?, repo?, requestHeaders?, token?, updaterCacheDirName?, vPrefixedTagName? } | object { bucket, provider, acl?, channel?, encryption?, endpoint?, path?, publishAutoUpdate?, publisherName?, region?, requestHeaders?, storageClass?, updaterCacheDirName? } | object { name, provider, region, acl?, channel?, path?, publishAutoUpdate?, publisherName?, requestHeaders?, updaterCacheDirName? } | object { provider, url, channel?, publishAutoUpdate?, publisherName?, requestHeaders?, updaterCacheDirName?, useMultipleRangeRequest? } | object { provider, publishAutoUpdate?, publisherName?, requestHeaders?, updateProvider?, updaterCacheDirName?, <key>: {} } | object { account, product, provider, channel?, platform?, publishAutoUpdate?, publisherName?, requestHeaders?, updaterCacheDirName? } | object { provider, channels?, publishAutoUpdate?, publisherName?, repo?, requestHeaders?, updaterCacheDirName? } | object { owner, provider, slug, channel?, publishAutoUpdate?, publisherName?, requestHeaders?, token?, updaterCacheDirName?, username? } | [object { provider, channel?, host?, owner?, private?, protocol?, publishAutoUpdate?, publisherName?, releaseType?, repo?, requestHeaders?, token?, updaterCacheDirName?, vPrefixedTagName? } | object { bucket, provider, acl?, channel?, encryption?, endpoint?, path?, publishAutoUpdate?, publisherName?, region?, requestHeaders?, storageClass?, updaterCacheDirName? } | object { name, provider, region, acl?, channel?, path?, publishAutoUpdate?, publisherName?, requestHeaders?, updaterCacheDirName? } | object { provider, url, channel?, publishAutoUpdate?, publisherName?, requestHeaders?, updaterCacheDirName?, useMultipleRangeRequest? } | object { provider, publishAutoUpdate?, publisherName?, requestHeaders?, updateProvider?, updaterCacheDirName?, <key>: {} } | object { account, product, provider, channel?, platform?, publishAutoUpdate?, publisherName?, requestHeaders?, updaterCacheDirName? } | object { provider, channels?, publishAutoUpdate?, publisherName?, repo?, requestHeaders?, updaterCacheDirName? } | object { owner, provider, slug, channel?, publishAutoUpdate?, publisherName?, requestHeaders?, token?, updaterCacheDirName?, username? } | string, ...] | null | string
   Details:
    * configuration.publish.provider should be "github".
      -> The provider. Must be `github`.
    * configuration.publish.provider should be "s3".
      -> The provider. Must be `s3`.
    * configuration.publish.provider should be "spaces".
      -> The provider. Must be `spaces`.
    * configuration.publish.provider should be "custom".
      -> The provider. Must be `custom`.
    * configuration.publish.provider should be "keygen".
      -> The provider. Must be `keygen`.
    * configuration.publish.provider should be "snapStore".
      -> The provider. Must be `snapStore`.
    * configuration.publish.provider should be "bitbucket".
      -> The provider. Must be `bitbucket`.
     How to fix:
     1. Open https://www.electron.build/configuration/configuration
     2. Search the option name on the page (or type in into Search to find across the docs).
       * Not found? The option was deprecated or not exists (check spelling).
       * Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", not in the root.

ffongmdsp avatar Jun 02 '22 04:06 ffongmdsp

Looking at the source code seems publish functionality for generic provider is not implemented at all :(

...
/** @internal */
  scheduleUpload(publishConfig: PublishConfiguration, event: UploadTask, appInfo: AppInfo): void {
    if (publishConfig.provider === "generic") {
      return
    }

    const publisher = this.getOrCreatePublisher(publishConfig, appInfo)
...

le4onardo avatar Jun 23 '22 02:06 le4onardo

I'm also trying to publish (in electron-builder v23.1.0) using "generic" (used to work in 22.4). Note that electron-updater version makes no difference here. I'm using a Mac Studio, so the old version (22.4.1) doesn't compile correctly.

packge.json "publish" section: "publish": [ { "provider": "generic", "url": "https://storage.googleapis.com/XXXXXXdownloads/app-updates/" } ]

Getting electron-builder errors: output from npx electron-builder -w (get the same even if I use --publish always)

• electron-builder version=23.1.0 os=21.5.0 • loaded configuration file=package.json ("build" field) • loaded parent configuration file=/Users/XXXXX/source/electron/node_modules/electron-webpack/out/electron-builder.js ⨯ Invalid configuration object. electron-builder 23.1.0 has been initialized using a configuration object that does not match the API schema. --- deleted some lines ---

  • configuration.publish should be one of these: Details:
    • configuration.publish[0].provider should be "github". -> The provider. Must be github.
    • configuration.publish[0].provider should be "s3". -> The provider. Must be s3.
    • configuration.publish[0].provider should be "spaces". -> The provider. Must be spaces.
    • configuration.publish[0].provider should be "custom". -> The provider. Must be custom.
    • configuration.publish[0].provider should be "keygen". -> The provider. Must be keygen.
    • configuration.publish[0].provider should be "snapStore". -> The provider. Must be snapStore.
    • configuration.publish[0].provider should be "bitbucket". -> The provider. Must be bitbucket. How to fix:
    1. Open https://www.electron.build/configuration/configuration
    2. Search the option name on the page (or type in into Search to find across the docs). * Not found? The option was deprecated or not exists (check spelling). * Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", not in the root. at validate (/Users/XXXXX/source/electron/node_modules/@develar/schema-utils/dist/validate.js:86:11) at Object.validateConfig (/Users/XXXXX/source/electron/node_modules/app-builder-lib/src/util/config.ts:240:3) at Packager._build (/Users/gXXXXX/source/electron/node_modules/app-builder-lib/src/packager.ts:342:5) at Packager.build (/Users/XXXXX/source/electron/node_modules/app-builder-lib/src/packager.ts:337:12) at Object.executeFinally (/Users/XXXXX/source/electron/node_modules/builder-util/src/promise.ts:12:14)

Note that at https://www.electron.build/configuration/publish, generic is defined!

I use google cloud, not any of the other listed options, but generic has worked well so far.

Please help.

grumpygary avatar Jul 04 '22 13:07 grumpygary

Looking at the source code seems publish functionality for generic provider is not implemented at all :(

...
/** @internal */
  scheduleUpload(publishConfig: PublishConfiguration, event: UploadTask, appInfo: AppInfo): void {
    if (publishConfig.provider === "generic") {
      return
    }

    const publisher = this.getOrCreatePublisher(publishConfig, appInfo)
...

This should be correct, as it is up to the developer to upload the dist files manually.

grumpygary avatar Jul 04 '22 14:07 grumpygary

@grumpygary I'm unable to reproduce that issue on 23.2.0 with the exact publish config you provided. It works in my electron-builder.js config file

@le4onardo yes, the generic publisher is for generating the updater <os>-latest file. You'll need to implement the upload yourself. Alternatively, you can implement a Publisher for electron-builder, happy to help give pointers there, there's unit tests for easy setup as well.

mmaietta avatar Jul 04 '22 19:07 mmaietta

I'm using webpack 4. I cleared the yarn.lock file & the node_moduels folder. Rebuilt everything. Same result.

Are you using WP 4 or WP 5?

grumpygary avatar Jul 04 '22 20:07 grumpygary

I realized that the webpack version wasn't that important, as the web stuff was already bundled. I got it to work by commenting out the "throw" in validate (it's not really an error: "generic" basically says let the developer handle it). If comes back to bite me I'll deal with it then.

grumpygary avatar Jul 05 '22 14:07 grumpygary

Okay, sounds good.

I tested with the electron-quick-start-typescript project

mmaietta avatar Jul 05 '22 15:07 mmaietta

I upgraded to 23.1.0 today to get the python fix for OSX and started hitting this error as well:

-> Options related to how build Linux targets.
   Details:
    * configuration.linux.publish[0].provider should be "github".
      -> The provider. Must be `github`.
    * configuration.linux.publish[0].provider should be "s3".
      -> The provider. Must be `s3`.
    * configuration.linux.publish[0].provider should be "spaces".
      -> The provider. Must be `spaces`.
    * configuration.linux.publish[0].provider should be "custom".
      -> The provider. Must be `custom`.
    * configuration.linux.publish[0].provider should be "keygen".
      -> The provider. Must be `keygen`.
    * configuration.linux.publish[0].provider should be "snapStore".
      -> The provider. Must be `snapStore`.
    * configuration.linux.publish[0].provider should be "bitbucket".
      -> The provider. Must be `bitbucket`.

Happening for all windows/mac/linux on a previously working configuration. Example:

"publish": [
        {
          "provider": "generic",
          "url": "https://{redacted}/AppBuilds/linux",
          "useMultipleRangeRequest": false,
          "publishAutoUpdate": false,
        },
        {
          "provider": "s3",
          "bucket": "{redacted}",
          "path": "AppBuilds/linux",
          "publishAutoUpdate": true,
          "region": "us-west-2"
        }
      ]

alexciarlillo avatar Jan 26 '23 15:01 alexciarlillo

@alexciarlillo https://github.com/electron-userland/electron-builder/issues/6493#issuecomment-1174220411

I'm unable to reproduce that issue on 23.2.0

mmaietta avatar Jan 26 '23 22:01 mmaietta

Sorry I should have clarified I also tried on 23.6.0 and hit the same issue. I am not sure why you cant repro. I will gather more information tomorrow and open a new issue. Clearly something is up if multiple people are experiencing this upon upgrading. Are you testing on a configuration with a generic provider? Maybe the issue has something to do with configs from package.json instead of electron-builder.js.

alexciarlillo avatar Jan 26 '23 22:01 alexciarlillo

Okay, please open a new ticket since it's different from the version reported in this. A minimum reproducible repo using electron-quick-start will likely be necessary

Note, due to the GH Action release processes, I'm only able to make releases for v24-alpha

mmaietta avatar Jan 26 '23 22:01 mmaietta

https://github.com/electron-userland/electron-builder/issues/6493#issuecomment-1174220411

Hey @mmaietta! I'd be interested to add a Google Cloud publisher. Can I take you up on your offer for pointers? Happy to take this discussion offline since it's not directly related to this issue. My email is in my profile!

zichongkao avatar Feb 21 '23 23:02 zichongkao

Happened to me when using provider: "generic" with url: null. Fixing the url field fixed my issue.

sduthil avatar Mar 14 '23 20:03 sduthil