tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
82k stars 2.46k forks source link

[bug] Updater build fails. #7679

Closed rnrnstar2 closed 1 year ago

rnrnstar2 commented 1 year ago

Describe the bug

An error occurs when the updater's active is set to true. If false, complete successfully.

As per the document, I have created a signature, set bash environment variables, and set pubkey in tauri.conf.json.

What error is Error Invalid padding?

$ yarn tauri build
yarn run v1.22.19

○  (Static)  automatically rendered as static HTML (uses no initial props)

- info Creating an optimized production build ..   Compiling app v0.1.0 (/Users/rnrnstar/github/VolumeAchievementTool/apps/tradeclicker/src-tauri)
    Finished release [optimized] target(s) in 5.95s
    Bundling TradeClicker.app (/Users/rnrnstar/github/VolumeAchievementTool/apps/tradeclicker/src-tauri/target/release/bundle/macos/TradeClicker.app)
    Bundling TradeClicker_0.0.1_aarch64.dmg (/Users/rnrnstar/github/VolumeAchievementTool/apps/tradeclicker/src-tauri/target/release/bundle/dmg/TradeClicker_0.0.1_aarch64.dmg)
     Running bundle_dmg.sh
    Bundling /Users/rnrnstar/github/VolumeAchievementTool/apps/tradeclicker/src-tauri/target/release/bundle/macos/TradeClicker.app.tar.gz (/Users/rnrnstar/github/VolumeAchievementTool/apps/tradeclicker/src-tauri/target/release/bundle/macos/TradeClicker.app.tar.gz)
    Finished 2 bundles at:
        /Users/rnrnstar/github/VolumeAchievementTool/apps/tradeclicker/src-tauri/target/release/bundle/macos/TradeClicker.app
        /Users/rnrnstar/github/VolumeAchievementTool/apps/tradeclicker/src-tauri/target/release/bundle/dmg/TradeClicker_0.0.1_aarch64.dmg
        /Users/rnrnstar/github/VolumeAchievementTool/apps/tradeclicker/src-tauri/target/release/bundle/macos/TradeClicker.app.tar.gz (updater)

       Error Invalid padding
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproduction

No response

Expected behavior

No response

Platform and versions

[✔] Environment
    - OS: Mac OS 13.4.1 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.71.1 (eb26296b5 2023-08-03)
    ✔ Cargo: 1.71.1 (7f1d04c00 2023-07-29)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 20.5.0
    - pnpm: 7.26.3
    - yarn: 1.22.19
    - npm: 9.8.0

[-] Packages
    - tauri [RUST]: 1.4.1
    - tauri-build [RUST]: 1.4.0
    - wry [RUST]: 0.24.3
    - tao [RUST]: 0.16.2
    - @tauri-apps/api [NPM]: 1.4.0
    - @tauri-apps/cli [NPM]: 1.4.0

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../out
    - devPath: http://localhost:3000/
    - framework: React (Next.js)
    - bundler: Webpack

Stack trace

No response

Additional context

No response

FabianLars commented 1 year ago

I may be wrong, but I think invalid padding could happen if the pubkey in tauri.conf.json is a file path and not the actual content of that file. Could you check that first please?

rnrnstar2 commented 1 year ago

I used to set the signature code as is. I didn't set the file path. So I set pubkey and privatekey like below.

"updater": {
   "active": true,
   "dialog": true,
   "endpoints": [
     "https://tauri-updater.s3.ap-northeast-1.amazonaws.com/release_check.json"
   ],
   "pubkey": "/Users/xxx/.tauri/myapp.key.pub"
},
export TAURI_PRIVATE_KEY="/Users/xxx/.tauri/myapp.key"

When I tried this, it changed to the following error.

Error Invalid byte 46, offset 16.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Error Invalid padding occurs when the actual content of that file is set as follows. export TAURI_PRIVATE_KEY="actual content of myapp.key"

amrbashir commented 1 year ago

the pubkey should be the content of the file not a path to, which should solve the Error Invalid byte 46, offset 16 error. for TAURI_PRIVATE_KEY env var, it is fine to use the path.

rnrnstar2 commented 1 year ago

thank you for your response.

"updater": {
   "active": true,
   "dialog": true,
   "endpoints": [
     "https://tauri-updater.s3.ap-northeast-1.amazonaws.com/release_check.json"
   ],
   "pubkey": "xxxxxxx_{myapp.key.pub content}_xxxxxx"
},
export TAURI_PRIVATE_KEY="xxxxxxx_{myapp.key content}_xxxxxx"

I tried setting the file contents like the code above, but I still get the Error Invalid padding error.

amrbashir commented 1 year ago

try export TAURI_PRIVATE_KEY="/path/to/myapp.key"

rnrnstar2 commented 1 year ago
- info Creating an optimized production build ..   Compiling app v0.1.0 (/Users/rnrnstar/github/VolumeAchievementTool/apps/tradeclicker/src-tauri)
    Finished release [optimized] target(s) in 7.48s
    Bundling TradeClicker.app (/Users/rnrnstar/github/VolumeAchievementTool/apps/tradeclicker/src-tauri/target/release/bundle/macos/TradeClicker.app)
    Bundling TradeClicker_1.0.0_aarch64.dmg (/Users/rnrnstar/github/VolumeAchievementTool/apps/tradeclicker/src-tauri/target/release/bundle/dmg/TradeClicker_1.0.0_aarch64.dmg)
     Running bundle_dmg.sh
       Error failed to bundle project: error running bundle_dmg.sh
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I tried export TAURI_PRIVATE_KEY="/path/to/myapp.key" I got this error.

amrbashir commented 1 year ago

The good news is that the updater is working, the bad new is that you hit https://github.com/tauri-apps/tauri/issues/3055 so I will go ahead close this issue.

murnifine commented 1 month ago

The good news is that the updater is working, the bad new is that you hit #3055 so I will go ahead close this issue.

Hi, I'm having the same problem what did you do to make it work?

   Compiling app v0.0.1 (D:\Developer\myapp\src-tauri)
    Finished `release` profile [optimized] target(s) in 20.56s
    Built application at: D:\Developer\myapp\src-tauri\target\release\app.exe
    Info Target: x64
    Running candle for "main.wxs"
    Running light to produce D:\Developer\myapp\src-tauri\target\release\bundle\msi\apppku_0.0.1_x64_en-US.msi
    Info Target: x64
    Running makensis.exe to produce D:\Developer\myapp\src-tauri\target\release\bundle\nsis\apppku_0.0.1_x64-setup.exe
    Warn The bundler was configured to create updater artifacts but no updater-enabled targets were built. Please enable one of these targets: app, appimage, msi, nsis
    Finished 2 bundles at:
        D:\Developer\myapp\src-tauri\target\release\bundle\msi\apppku_0.0.1_x64_en-US.msi
        D:\Developer\myapp\src-tauri\target\release\bundle\nsis\apppku_0.0.1_x64-setup.exe

    Error Invalid padding