tauri-apps / tauri

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

[bug] Error in generating wix installer on Windows #4791

Closed miniBill closed 1 year ago

miniBill commented 2 years ago

Describe the bug

I've used the tauri-apps/tauri-action@v0 to automatically build the installer, but I get this error:

     Finished release [optimized] target(s) in 2m 22s
        Info Target: x64
     Signing C:\actions-runner\_work\[...]\src-tauri\target\release\[...].exe
     Signing C:\actions-runner\_work\[...]\src-tauri\target\release\[...].exe with identity "ae7ce42c742d8b5f1ce7547294c42dbc8b21ad91"
        Info "Done Adding Additional Store\r\nSuccessfully signed: C:\\actions-runner\\_work\\[...]\\src-tauri\\target\\release\\[...].exe\r\r\n"
     Running candle for "main.wxs"
     Running light to produce C:\actions-runner\_work\[...]\src-tauri\target\release\bundle/msi/[...]_0.0.4_x64_en-US.msi
       Error failed to bundle project: error running light.exe: error running light.exe: `failed to run C:\Users\GithubRunner\AppData\Local\tauri/WixTools\light.exe`
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproduction

Use tauri-apps/tauri-action@v0 on a self-hosted runner

Expected behavior

The release gets correctly created

Platform and versions

@tauri-apps/cli 1.0.3 @tauri-apps/api 1.0.2 tauri 1.0.5 tauri-build 1.0.4

Stack trace

No response

Additional context

No response

FabianLars commented 2 years ago

Can you run it with the verbose flag enabled, like yarn tauri build --verbose -> in the action you can specify --verbose in the args property.

miniBill commented 2 years ago

Well, the verbose logs definitely tell a story:

     Running [tauri_bundler::bundle::common] Command `C:\Users\GithubRunner\AppData\Local\tauri/WixTools\candle.exe  -arch x64 main.wxs -dSourceDir=C:\actions-runner\_work\[...]\[...]\src-tauri\target\release\[...].exe`
Windows Installer XML Toolset Compiler version 3.11.2.4516
Copyright (c) .NET Foundation and contributors. All rights reserved.

main.wxs
     Running [tauri_bundler::bundle::windows::msi::wix] light to produce C:\actions-runner\_work\[...]\[...]\src-tauri\target\release\bundle/msi/[...]_0.0.4_x64_en-US.msi
     Running [tauri_bundler::bundle::common] Command `C:\Users\GithubRunner\AppData\Local\tauri/WixTools\light.exe  -ext WixUIExtension -ext WixUtilExtension -o C:\actions-runner\_work\[...]\[...]\src-tauri\target\release\wix\x64\output.msi -cultures:en-us -loc C:\actions-runner\_work\[...]\[...]\src-tauri\target\release\wix\x64\locale.wxl *.wixobj`
Windows Installer XML Toolset Linker version 3.11.2.4516
Copyright (c) .NET Foundation and contributors. All rights reserved.

light.exe : error LGHT0217 : Error executing ICE action 'ICE01'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0217 : Error executing ICE action 'ICE02'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0217 : Error executing ICE action 'ICE03'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0217 : Error executing ICE action 'ICE04'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0217 : Error executing ICE action 'ICE05'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0217 : Error executing ICE action 'ICE06'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0217 : Error executing ICE action 'ICE07'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".
light.exe : error LGHT0216 : An unexpected Win32 exception with error code 0x643 occurred: Action - 'ICE09' Fatal error during installation
       Error [tauri_cli_node] failed to bundle project: error running light.exe: error running light.exe: `failed to run C:\Users\GithubRunner\AppData\Local\tauri/WixTools\light.exe`
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Might it be because the githubrunner user is not an admin?

lucasfernog commented 2 years ago

@miniBill I've seen this issue on a GitLab runner, and the issue was that I had some large secrets being dumped to the runner, so I had to delete some unused environment variables. I found this SO answer that helped me: https://stackoverflow.com/questions/1064580/wix-3-0-throws-error-217-while-being-executed-by-continuous-integration/9722623#9722623 So I'd check the environment variable size and delete unused GH secrets if you have any.

miniBill commented 2 years ago

The issue is that the GH secrets are needed for the previous steps of the tauri build. Could tauri itself clean them before calling wix? Also, the build actually works on the GH runners. Maybe they have a cleaner ENV and barely fit? :thinking:

lucasfernog commented 2 years ago

@miniBill You can just clear the larger env vars before running tauri build, like:

$Env:APPLE_CERTIFICATE = ''
$Env:SOME_HUGE_VAR = ''
tauri build --verbose

(that syntax is for powershell, if the runner uses a different shell you can just use unset or any other equivalent)

lucasfernog commented 2 years ago

We could clear the env when running wix, though i'm not sure if that would break any feature in case wix relies on env vars. Worth trying.

lucasfernog commented 2 years ago

Pushed a fix if you want to test it. Run cargo install --git https://github.com/tauri-apps/tauri --branch fix/wix-clear-env tauri-cli --force and then add the tauriScript input to the tauri-action usage:

- uses: tauri-apps/tauri-action@v0
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tauriScript: cargo tauri

EDIT: gotta fix an issue first :( EDIT2: Done.

miniBill commented 2 years ago

I get the same error, unfortunately.

The relevant part of the GitHub action:

      - name: Install app dependencies and build web
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          yarn
          make Makefile.images
          make -j dist
          cargo install --git https://github.com/tauri-apps/tauri --branch fix/wix-clear-env tauri-cli --force

      - name: "Build and release the app (PR)"
        if: github.event_name == 'pull_request'
        uses: tauri-apps/tauri-action@v0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
          TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
        with:
          args: --verbose
          tagName: pr-${{ github.head_ref }}
          releaseName: "[XXX] - PR ${{ github.head_ref }}"
          releaseBody: "See the assets to download this version and install."
          releaseDraft: true
          prerelease: true
          configPath: src-tauri/tauri.conf.release.json
          tauriScript: cargo tauri
lucasfernog commented 2 years ago

@miniBill that's sad :( only other thing i could do is allow skipping that ICE validation from WiX. Any chance your GH secrets starts with TAURI? that's the only env vars i'm keeping, so it shouldn't cause that error unless the problem is somewhere else :/

lucasfernog commented 2 years ago

@miniBill can you try again, but this time with the TAURI_WIX_SKIP_MSI_VALIDATION env set to true?

miniBill commented 2 years ago

@lucasfernog only TAURI_PRIVATE_KEY and TAURI_KEY_PASSWORD start with TAURI and those are inevitable.

With TAURI_WIX_SKIP_MSI_VALIDATION I unfortunately still get:

light.exe : error LGHT0217 : Error executing ICE action 'ICE02'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".

How can I make sure that the action is using the correct tauri CLI from the branch?

lucasfernog commented 2 years ago

@miniBill can you share the build logs?

miniBill commented 2 years ago

@lucasfernog https://dpaste.com/C63LWSCXC Edited to add: the link will expire in a week

lucasfernog commented 2 years ago

@miniBill the -sval argument wasn't added by the CLI when running light.exe, so either the CLI isn't up to date, or the TAURI_WIX_SKIP_MSI_VALIDATION argument isn't reaching it. I've pushed a change to always run with -sval so we can test it.

vedaprakashms commented 1 year ago

i am facing the same issue, i am not trying to build in CI/CD but on local machine, i am getting the error similar to this. relevent section of verbose is below,

main.wxs Running [tauri_bundler::bundle::windows::msi::wix] light to produce C:\Users\abc\Documents\projects\tarui\xyz\src-tauri\target\release\bundle/msi/xyz_0.1.0_x64_en-US.msi Running [tauri_bundler::bundle::common] CommandC:\Users\abc\AppData\Local\tauri/WixTools\light.exe -ext WixUIExtension -ext WixUtilExtension -o C:\Users\abc\Documents\projects\tarui\xyz\src-tauri\target\release\wix\x64\output.msi -cultures:en-us -loc C:\Users\abc\Documents\projects\tarui\xyz\src-tauri\target\release\wix\x64\locale.wxl *.wixobj` Windows Installer XML Toolset Linker version 3.11.2.4516 Copyright (c) .NET Foundation and contributors. All rights reserved.

light.exe : error LGHT0217 : Error executing ICE action 'ICE01'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.". light.exe : error LGHT0217 : Error executing ICE action 'ICE02'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.". light.exe : error LGHT0217 : Error executing ICE action 'ICE03'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.". light.exe : error LGHT0217 : Error executing ICE action 'ICE04'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.". light.exe : error LGHT0217 : Error executing ICE action 'ICE05'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.". light.exe : error LGHT0217 : Error executing ICEFa action 'ICE06'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.". light.exe : error LGHT0217 : Error executing ICE action 'ICE07'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wixtoolset.org/documentation/error217/ for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.". light.exe : error LGHT0216 : An unexpected Win32 exception with error code 0x643 occurred: Action - 'ICE09' Fatal error during installation Error [tauri_cli_node] failed to bundle project: error running light.exe: error running light.exe: failed to run C:\Users\abc\AppData\Local\tauri/WixTools\light.exe error Command failed with exit code 1.`

i am new to tauri, and not able to figure out what the issue is. any help is appreciated.

lucasfernog commented 1 year ago

@vedaprakashms can you try my fix?

cargo install tauri-cli --git https://github.com/tauri-apps/tauri --branch dev
cargo tauri build