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

Deploy.ps1 fails during UI Build due to UnicodeEncodeError #176

Closed
daveinci opened this issue Sep 27, 2023 · 4 comments · Fixed by #181
Closed

Deploy.ps1 fails during UI Build due to UnicodeEncodeError #176

daveinci opened this issue Sep 27, 2023 · 4 comments · Fixed by #181
Assignees
Labels
bug Something isn't working

Comments

@daveinci
Copy link

Describe the bug
Running deploy.ps1 fails during UI build phase, specifically during vite install, due to handling of error received during vite installation when it returns a checkmark (character '\u2713') in its result. Running the commands manually work.

To Reproduce
Steps to reproduce the behavior:

  1. Follow deployment instructions for "Full" deployment with PrivateACR and custom $ResourceNames defined. https://azure.github.io/ipam/#/deployment/README
  2. See error:
    RUN npm run build ---> Running in
    | cf61f8120ed6 > [email protected] build > vite build vite v4.4.9 building for production... transforming...
    | ERROR: The command failed with an unexpected error. Here is the traceback: ERROR: 'charmap' codec can't encode
    | character '\u2713' in position 0: character maps to Traceback (most recent call last): File
    | "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke File
    | "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line
    | 663, in execute File
    | "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line
    | 726, in _run_jobs_serially File
    | "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line
    | 697, in _run_job File
    | "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line
    | 333, in call File
    | "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acr/build.py", line 143, in acr_build File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acr/_stream_utils.py", line 58, in stream_logs File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/command_modules/acr/_stream_utils.py", line 143, in _stream_logs File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\colorama/ansitowin32.py", line 41, in write File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\colorama/ansitowin32.py", line 162, in write File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\colorama/ansitowin32.py", line 187, in write_and_convert File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\colorama/ansitowin32.py", line 195, in write_plain_text File "encodings\cp1252.py", line 19, in encode UnicodeEncodeError: 'charmap' codec can't encode character '\u2713' in position 0: character maps to To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Expected behavior
Expect deploy.ps1 to complete without error and ipam applications to be running in app service.
Screenshot 2023-09-27 090219

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows 11, latest versions of prerequisites installed: PowerShell 7.3.7, Bicep 0.21.1, Az CLI 2.53.0, python 3.11.5
  • Browser [e.g. chrome, safari] N/A
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@DCMattyG DCMattyG self-assigned this Sep 27, 2023
@DCMattyG DCMattyG added the bug Something isn't working label Sep 27, 2023
@DCMattyG
Copy link
Contributor

Good morning @daveinci, I'm working on reproducing this now and will circle back with you shortly once I have some answers on the best way to address this. Thank you so much for bringing this to my attention!

@DCMattyG
Copy link
Contributor

Hey @daveinci, the root cause for this stems from how the Vite build process will emit an Unicode "checkmark" character, and then that being captured by PowerShell and redirected to a variable. Long story short, this is an issue with how this is handled in Windows systems, but there is something you can try as a workaround for now.

Take a look at the fix in this link, which shows how to enable UTF-8 support in Windows:
microsoft/knack#178

I would suggest enabling that for now and seeing if that unblocks you, and in the meantime I will continue working on a more permanent/universal fix for this issue.

Please let me know if the above helps!

@daveinci
Copy link
Author

Thanks @DCMattyG. I worked around by running the 'az acr build' commands manually. Enabling Control Panel -> Region -> Administrative -> Change system locale -> Beta: Use Unicode UTF-8 for worldwide language support would likely do the trick but appreciate you looking for the permanent/universal fix. Think that will help users.

@DCMattyG
Copy link
Contributor

DCMattyG commented Oct 8, 2023

Hi @daveinci, this issue has been addressed in PR #181. For now, I've changed the output of the build to "warn" which will stop the Unicode output seen at the "info" level. I've tested four many hours trying to find a way to alleviate this via scripting, but it appears unless you enable UTF-8 support in Windows (as mentioned in my previous comment), nothing I've found through script changes has been able to alleviate this issue.

I'll keep looking for a better workaround, but now this issue should be resolved. Please let me know if you have any further issues and we'll get right on them. Thanks again!

@DCMattyG DCMattyG closed this as completed Oct 8, 2023
@DCMattyG DCMattyG linked a pull request Oct 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants