electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.71k stars 1.74k forks source link

"Invalid argument" error when migrating S3 to google storage #3479

Closed jakoboo closed 5 years ago

jakoboo commented 6 years ago

I followed gcloud storage migration guide and changed my publish config accordingly to:

publish: {
    provider: "s3",
    endpoint: "https://storage.googleapis.com",
    bucket: "<bucket-name>",
    path: "/publish/${version}/"
},

The problem is that ONLY .blockmap file is uploaded correctly and i get Invalid argument. error on both .exe and .AppImage

Terminal output ``` INFO Building app with electron-builder: • electron-builder version=20.31.2 • writing effective config file=dist_electron/builder-effective-config.yaml • no native production dependencies • packaging platform=linux arch=x64 electron=3.0.7 appOutDir=dist_electron/linux-unpacked • building target=AppImage arch=x64 file=dist_electron/AegisPack-linux-x86_64.AppImage • application Linux category is set to default "Utility" reason=linux.category is not set and cannot map from macOS docs=https://electron.build/configuration/configuration#LinuxBuildOptions-category • no native production dependencies • packaging platform=win32 arch=x64 electron=3.0.7 appOutDir=dist_electron/win-unpacked • publishing publisher=S3 (bucket: download.aegispack.com, endpoint: https://storage.googleapis.com) • uploading file=AegisPack-linux-x86_64.AppImage provider=S3 ⨯ InvalidArgument: Invalid argument. status code: 400, request id: , host id: github.com/develar/app-builder/pkg/publisher.upload /Users/develar/go/src/github.com/develar/app-builder/pkg/publisher/s3.go:170 github.com/develar/app-builder/pkg/publisher.ConfigurePublishToS3Command.func1 /Users/develar/go/src/github.com/develar/app-builder/pkg/publisher/s3.go:56 github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*actionMixin).applyActions /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/actions.go:28 github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*Application).applyActions /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/app.go:557 github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*Application).execute /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/app.go:390 github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*Application).Parse /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/app.go:222 main.main /Users/develar/go/src/github.com/develar/app-builder/main.go:74 runtime.main /usr/local/Cellar/go/1.11.1/libexec/src/runtime/proc.go:201 runtime.goexit /usr/local/Cellar/go/1.11.1/libexec/src/runtime/asm_amd64.s:1333 • default Electron icon is used reason=application icon is not set • no native production dependencies • packaging platform=win32 arch=ia32 electron=3.0.7 appOutDir=dist_electron/win-ia32-unpacked • building target=nsis file=dist_electron/AegisPack-win-Setup.exe archs=x64, ia32 oneClick=false • building block map blockMapFile=dist_electron/AegisPack-win-Setup.exe.blockmap • uploading file=AegisPack-win-Setup.exe.blockmap provider=S3 • uploading file=AegisPack-win-Setup.exe provider=S3 ERROR Error: /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-bin/linux/x64/app-builder exited with code 1 Error: /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-bin/linux/x64/app-builder exited with code 1 at ChildProcess.childProcess.once.code (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/builder-util/src/util.ts:253:14) at Object.onceWrapper (events.js:272:13) at ChildProcess.emit (events.js:180:13) at ChildProcess.emit (domain.js:422:20) at maybeClose (internal/child_process.js:936:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5) From previous event: at CancellationToken.createPromise (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/builder-util-runtime/src/CancellationToken.ts:51:12) at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/electron-publish/src/s3/BaseS3Publisher.ts:49:36 at Generator.next () From previous event: at S3Publisher.upload (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/electron-publish/src/s3/BaseS3Publisher.ts:22:32) at PublishManager.scheduleUpload (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/publish/PublishManager.ts:151:40) at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/publish/PublishManager.ts:178:14 From previous event: at PublishManager.artifactCreatedWithoutExplicitPublishConfig (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/publish/PublishManager.ts:154:83) at EventEmitter.PublishManager.packager.artifactCreated.event (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/publish/PublishManager.ts:109:39) at EventEmitter.emit (events.js:185:15) at EventEmitter.emit (domain.js:422:20) at Packager.dispatchArtifactCreated (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/packager.ts:234:23) at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/targets/AppImageTarget.ts:80:19 From previous event: at AppImageTarget.build (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/targets/AppImageTarget.ts:28:44) at Function.buildAsyncTargets (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/platformPackager.ts:139:36) at LinuxPackager.packageInDistributableFormat (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/platformPackager.ts:118:24) at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/platformPackager.ts:113:10 at Generator.next () at runCallback (timers.js:763:18) at tryOnImmediate (timers.js:734:5) at processImmediate (timers.js:716:5) at process.topLevelDomainCallback (domain.js:102:23) From previous event: at LinuxPackager.pack (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/platformPackager.ts:110:95) at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/packager.ts:375:24 at Generator.next () at xfs.stat (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16) at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/graceful-fs/polyfills.js:285:20 at FSReqWrap.oncomplete (fs.js:171:5) From previous event: at Packager.doBuild (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/packager.ts:343:39) at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/packager.ts:313:57 at Generator.next () at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/graceful-fs/graceful-fs.js:111:16 at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/graceful-fs/graceful-fs.js:45:10 at FSReqWrap.oncomplete (fs.js:153:20) From previous event: at Packager._build (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/packager.ts:284:133) at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/packager.ts:280:23 at Generator.next () at runCallback (timers.js:763:18) at tryOnImmediate (timers.js:734:5) at processImmediate (timers.js:716:5) at process.topLevelDomainCallback (domain.js:102:23) From previous event: at Packager.build (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/packager.ts:237:14) at build (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/app-builder-lib/src/index.ts:58:28) at Object.build (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/electron-builder/src/builder.ts:227:10) at buildApp (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/vue-cli-plugin-electron-builder/index.js:172:14) at bundle.run (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/vue-cli-plugin-electron-builder/index.js:154:15) at finalCallback (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/vue-cli-plugin-electron-builder/node_modules/webpack/lib/Compiler.js:210:39) at hooks.done.callAsync.err (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/vue-cli-plugin-electron-builder/node_modules/webpack/lib/Compiler.js:259:14) at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/tapable/lib/HookCodeFactory.js:32:10), :15:1) at AsyncSeriesHook.lazyCompileHook (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/tapable/lib/Hook.js:154:20) at emitRecords.err (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/vue-cli-plugin-electron-builder/node_modules/webpack/lib/Compiler.js:257:22) at Compiler.emitRecords (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/vue-cli-plugin-electron-builder/node_modules/webpack/lib/Compiler.js:371:39) at emitAssets.err (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/vue-cli-plugin-electron-builder/node_modules/webpack/lib/Compiler.js:251:10) at hooks.afterEmit.callAsync.err (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/vue-cli-plugin-electron-builder/node_modules/webpack/lib/Compiler.js:357:14) at AsyncSeriesHook.eval [as callAsync] (eval at create (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/tapable/lib/HookCodeFactory.js:32:10), :6:1) at AsyncSeriesHook.lazyCompileHook (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/tapable/lib/Hook.js:154:20) at asyncLib.forEach.err (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/vue-cli-plugin-electron-builder/node_modules/webpack/lib/Compiler.js:354:27) at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/neo-async/async.js:2825:7 at done (/home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/neo-async/async.js:2861:11) at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/neo-async/async.js:2813:7 at /home/jakub/go/src/github.com/jakoboo/aegispack-launcher/launcher/node_modules/graceful-fs/graceful-fs.js:45:10 at FSReqWrap.oncomplete (fs.js:153:20) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ⨯ InvalidArgument: Invalid argument. status code: 400, request id: , host id: github.com/develar/app-builder/pkg/publisher.upload /Users/develar/go/src/github.com/develar/app-builder/pkg/publisher/s3.go:170 github.com/develar/app-builder/pkg/publisher.ConfigurePublishToS3Command.func1 /Users/develar/go/src/github.com/develar/app-builder/pkg/publisher/s3.go:56 github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*actionMixin).applyActions /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/actions.go:28 github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*Application).applyActions /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/app.go:557 github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*Application).execute /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/app.go:390 github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin.(*Application).Parse /Users/develar/go/src/github.com/develar/app-builder/vendor/github.com/alecthomas/kingpin/app.go:222 main.main /Users/develar/go/src/github.com/develar/app-builder/main.go:74 runtime.main /usr/local/Cellar/go/1.11.1/libexec/src/runtime/proc.go:201 runtime.goexit /usr/local/Cellar/go/1.11.1/libexec/src/runtime/asm_amd64.s:1333 ```
jakoboo commented 6 years ago

This is probably caused by key option because downloaded files (i managed to publish .exe for nsis-web, without .7z files tho) have names like publish%2F0.0.0-snapshot%2FAegisPack-win-Setup.exe

slawek-brainhub commented 5 years ago

I've spotted the same issue, so I used DEBUG=electron-builder flag to find some more detailed error and it looks, that it's not a problem with key option.

node_modules/app-builder-bin/mac/app-builder publish-s3 --bucket BUCKET_NAME --key ARTIFACT_NAME --file PATH/ARTIFACT_NAME --acl public-read --endpoint http://storage.googleapis.com

So I've taken Wireshark and I found that .blockmap file is uploaded by PUT method. While uploading .exe and .dmg, app-builder uses POST method. And then, receives error message from GCS:

POST object expects Content-Type multipart/form-data

Any idea how to fix that?

stale[bot] commented 5 years ago

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