Repository: nativefier/nativefier

Issue #1036: Windows 10: {Taskbar, Notification} app name displays function code string and Electron icon
Created: 2020-08-27T04:09:02Z
Homework

 I looked at nativefier --help and https://github.com/jiahaog/nativefier/blob/master/docs/api.md
 I searched existing issues, open & closed. Yes, my bug is new.
 I'm using the latest version available at https://github.com/jiahaog/nativefier/releases

Bug description
*Edit: After reboot of system Icon was updated. Name is still incorrect.
The properties icon and name when right clicking on the Windows 10 taskbar is incorrect
the application name is shown as a function string:
function(str) {
  if (arguments.length === 0) return this._name;
  this._name = str;
  return this;
}

Picture:

Steps to reproduce
Run nativefier on a Home assistant instance:
nativefier https://hass.example.tld -n "Home Assistant" --win32metadata "{\"ProductName\":\"Home Assistant\",\"InternalName\":\"Home Assistant\",\"FileDescription\":\"Home Assistant in an Electron App\"}" --tray --single-instance -i ./out.ico`

or just
nativefier https://hass.example.tld`

Run the nativefied application
Right click on the taskbar icon

verbose build output
C:\Users\Dugite code>nativefier https://hass.example.tld --verbose -n "Home Assistant" --win32metadata "{\"ProductName\":\"Home Assistant\",\"InternalName\":\"Home Assistant\",\"FileDescription\":\"Home Assistant in an Electron App\"}" --tray --single-instance -i ./out.ico
Running in verbose mode! This will produce a mountain of logs and is recommended only for troubleshooting or if you like Shakespeare.

Performing async options post-processing.
Inferring user agent for electron 9.2.0 / win32
Grabbing electron<->chrome versions file from https://atom.io/download/atom-shell/index.json
Got icon from options. Using it, no inferring needed
Got name Home Assistant from options. No inferring needed
Sanitized filename for Home Assistant : Home Assistant
Associated electron v9.2.0 to chrome v83.0.4103.122
Given chrome 83.0.4103.122 on win32, using user agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.122 Safari/537.36

Preparing Electron app...
Copying electron app from C:\Users\Dugite code\AppData\Roaming\npm\node_modules\nativefier\app to C:\Users\DUGITEC~1\AppData\Local\Temp\nativefier-11-53-6-app--1904-rv7JixWY0pxn
Writing app config to C:\Users\DUGITEC~1\AppData\Local\Temp\nativefier-11-53-6-app--1904-rv7JixWY0pxn\nativefier.json
No files to inject, skipping copy.
Updating C:\Users\DUGITEC~1\AppData\Local\Temp\nativefier-11-53-6-app--1904-rv7JixWY0pxn\package.json 'name' field to home-assistant-nativefier-787f8b

Converting icons...
Building for Windows and icon is already a .ico, no conversion needed

Packaging... This will take a few seconds, maybe minutes if the requested Electron isn't cached yet...
  electron-packager Electron Packager 15.1.0
  electron-packager Node v13.7.0
  electron-packager Host Operating system: win32 10.0.18363 (x64) +0ms
  electron-packager Packager Options: {"arch":"x64","asar":false,"darwinDarkModeSupport":false,"dir":"C:\\Users\\DUGITEC~1\\AppData\\Local\\Temp\\nativefier-11-53-6-app--1904-rv7JixWY0pxn","electronVersion":"9.2.0","icon":"./out.ico","name":"Home Assistant","out":"C:\\Users\\Dugite code","overwrite":true,"platform":"win32","targetUrl":"https://hass.example.tld/","tmpdir":false,"win32metadata":{"ProductName":"Home Assistant","InternalName":"Home Assistant","FileDescription":"Home Assistant in an Electron App"}} +0ms
  electron-packager Target Platforms: win32 +3ms
  electron-packager Target Architectures: x64 +0ms
  electron-packager Requiring author in package.json, as CompanyName was not specified for win32metadata +0ms
  electron-packager Inferring appVersion from version in C:\Users\DUGITEC~1\AppData\Local\Temp\nativefier-11-53-6-app--1904-rv7JixWY0pxn\package.json +7ms
  electron-packager Inferring win32metadata.CompanyName from author in C:\Users\DUGITEC~1\AppData\Local\Temp\nativefier-11-53-6-app--1904-rv7JixWY0pxn\package.json +2ms
  electron-packager Application name: Home Assistant +10ms
  electron-packager Target Electron version: 9.2.0 +1ms
  electron-packager Ignored path regular expressions: [ '/\\.git($|/)', '/node_modules/\\.bin($|/)', '\\.o(bj)?$' ] +0ms
  electron-packager Downloading Electron with options {"platform":"win32","arch":"x64","version":"9.2.0","artifactName":"electron"} +0ms
Packaging app for platform win32 x64 using electron v9.2.0
  electron-packager Creating C:\Users\Dugite code\win32-x64-template +5ms
  electron-packager Extracting C:\Users\Dugite code\AppData\Local\electron\Cache\httpsgithub.comelectronelectronreleasesdownloadv9.2.0electron-v9.2.0-win32-x64.zip\electron-v9.2.0-win32-x64.zip to C:\Users\Dugite code\win32-x64-template +2ms
  electron-packager Initializing app in C:\Users\Dugite code\Home Assistant-win32-x64 from C:\Users\Dugite code\win32-x64-template template +0ms
  electron-packager Ignored paths based on the out param: [
  'C:\\Users\\Dugite code\\Home Assistant-darwin-x64',
  'C:\\Users\\Dugite code\\Home Assistant-darwin-arm64',
  'C:\\Users\\Dugite code\\Home Assistant-linux-ia32',
  'C:\\Users\\Dugite code\\Home Assistant-linux-x64',
  'C:\\Users\\Dugite code\\Home Assistant-linux-armv7l',
  'C:\\Users\\Dugite code\\Home Assistant-linux-arm64',
  'C:\\Users\\Dugite code\\Home Assistant-linux-mips64el',
  'C:\\Users\\Dugite code\\Home Assistant-mas-x64',
  'C:\\Users\\Dugite code\\Home Assistant-mas-arm64',
  'C:\\Users\\Dugite code\\Home Assistant-win32-ia32',
  'C:\\Users\\Dugite code\\Home Assistant-win32-x64',
  'C:\\Users\\Dugite code\\Home Assistant-win32-arm64'
] +2s
  electron-packager Renaming electron.exe to Home Assistant.exe in C:\Users\Dugite code\Home Assistant-win32-x64 +52ms
  electron-packager Running rcedit with the options {"version-string":{"FileDescription":"Home Assistant in an Electron App","InternalName":"Home Assistant","OriginalFilename":"Home Assistant.exe","ProductName":"Home Assistant","CompanyName":"Jia Hao"},"file-version":"1.0.0","product-version":"1.0.0","icon":"./out.ico"} +0ms

Finalizing build...
Copying icons if necessary
Copying icon ./out.ico to C:\Users\Dugite code\Home Assistant-win32-x64\resources\app\icon.ico
App built to C:\Users\Dugite code\Home Assistant-win32-x64

C:\Users\Dugite code>


Context

Nativefier: 9.2.0
Node.js: v13.7.0
Npm: 6.13.6
OS: Windows 10 build 1909

Duplicate issue #1050: Notification bug on Windows 10
Created: 2020-09-28T18:55:21Z
Homework

[yes] I looked at nativefier --help and https://github.com/jiahaog/nativefier/blob/master/docs/api.md
[yes] I searched existing issues, open & closed. Yes, my bug is new.
[yes] I'm using the latest version available at https://github.com/jiahaog/nativefier/releases

Bug description
When I trigger a notification on Windows 10 Pro (20H2 - 19042.541) it shows me some code. Like this:

Also, the notification does not stay in the Action Center. Not sure if that is separate or related.
Steps to reproduce
Run the following command in Windows Terminal (app), via PowerShell 7.0.3 -- run as Administrator so I can install it into C:\Program Files:
nativefier --single-instance --tray start-in-tray --show-menu-bar --verbose "https://messages.google.com" "C:\Program Files\Nativefier"


Running in verbose mode! This will produce a mountain of logs and is recommended only for troubleshooting or if you like Shakespeare.

Performing async options post-processing.
Inferring user agent for electron 10.1.0 / win32
Grabbing electron<->chrome versions file from https://atom.io/download/atom-shell/index.json
Inferring icon for https://messages.google.com/ on win32
Inferring icon from store for https://messages.google.com/ on win32
Allowed icon formats when building for win32 (limited on Windows): [ '.ico' ]
Inferring name for https://messages.google.com/
Got 249 icons from gitcloud
Max icon match score: 2
Downloading https://jiahaog.github.io/nativefier-icons/files/google-messages.ico
Fetched 44.6 kb page at https://messages.google.com/
Inferred title: Messages by Google
Sanitized filename for Messages by Google : Messages by Google
Got an icon from the page.
Writing 361.4 kb icon to C:\Users\corey\AppData\Local\Temp\nativefier-14-43-7-iconinfer--6816-JSmxNAZtkYK5\icon.ico
Associated electron v10.1.0 to chrome v85.0.4183.87
Given chrome 85.0.4183.87 on win32, using user agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.87 Safari/537.36

Preparing Electron app...
Copying electron app from C:\Users\corey\AppData\Roaming\npm\node_modules\nativefier\app to C:\Users\corey\AppData\Local\Temp\nativefier-14-43-7-app--6816-qK4QDPh7m8cJ
Writing app config to C:\Users\corey\AppData\Local\Temp\nativefier-14-43-7-app--6816-qK4QDPh7m8cJ\nativefier.json
No files to inject, skipping copy.
Updating C:\Users\corey\AppData\Local\Temp\nativefier-14-43-7-app--6816-qK4QDPh7m8cJ\package.json 'name' field to messages-by-google-nativefier-a70f30

Converting icons...
Building for Windows and icon is already a .ico, no conversion needed

Packaging... This will take a few seconds, maybe minutes if the requested Electron isn't cached yet...
  electron-packager Electron Packager 15.1.0
  electron-packager Node v12.18.4
  electron-packager Host Operating system: win32 10.0.19042 (x64) +0ms
  electron-packager Packager Options: {"arch":"x64","asar":false,"darwinDarkModeSupport":false,"dir":"C:\\Users\\corey\\AppData\\Local\\Temp\\nativefier-14-43-7-app--6816-qK4QDPh7m8cJ","electronVersion":"10.1.0","icon":"C:\\Users\\corey\\AppData\\Local\\Temp\\nativefier-14-43-7-iconinfer--6816-JSmxNAZtkYK5\\icon.ico","name":"Messages by Google","out":"C:\\Program Files\\Nativefier","overwrite":true,"platform":"win32","targetUrl":"https://messages.google.com/","tmpdir":false,"win32metadata":{}} +1ms
  electron-packager Target Platforms: win32 +0ms
  electron-packager Target Architectures: x64 +0ms
  electron-packager Requiring author in package.json, as CompanyName was not specified for win32metadata +0ms
  electron-packager Inferring appVersion from version in C:\Users\corey\AppData\Local\Temp\nativefier-14-43-7-app--6816-qK4QDPh7m8cJ\package.json +4ms
  electron-packager Inferring win32metadata.CompanyName from author in C:\Users\corey\AppData\Local\Temp\nativefier-14-43-7-app--6816-qK4QDPh7m8cJ\package.json +0ms
  electron-packager Application name: Messages by Google +5ms
  electron-packager Target Electron version: 10.1.0 +0ms
  electron-packager Ignored path regular expressions: [ '/\\.git($|/)', '/node_modules/\\.bin($|/)', '\\.o(bj)?$' ] +0ms  electron-packager Downloading Electron with options {"platform":"win32","arch":"x64","version":"10.1.0","artifactName":"electron"} +0ms
Packaging app for platform win32 x64 using electron v10.1.0
  electron-packager Creating C:\Program Files\Nativefier\win32-x64-template +3ms
  electron-packager Extracting C:\Users\corey\AppData\Local\electron\Cache\httpsgithub.comelectronelectronreleasesdownloadv10.1.0electron-v10.1.0-win32-x64.zip\electron-v10.1.0-win32-x64.zip to C:\Program Files\Nativefier\win32-x64-template +0ms
  electron-packager Initializing app in C:\Program Files\Nativefier\Messages by Google-win32-x64 from C:\Program Files\Nativefier\win32-x64-template template +0ms
  electron-packager Ignored paths based on the out param: [ 'C:\\Program Files\\Nativefier' ] +1s
  electron-packager Renaming electron.exe to Messages by Google.exe in C:\Program Files\Nativefier\Messages by Google-win32-x64 +16ms
  electron-packager Running rcedit with the options {"version-string":{"OriginalFilename":"Messages by Google.exe","CompanyName":"Jia Hao"},"file-version":"1.0.0","product-version":"1.0.0","icon":"C:\\Users\\corey\\AppData\\Local\\Temp\\nativefier-14-43-7-iconinfer--6816-JSmxNAZtkYK5\\icon.ico"} +0ms

Finalizing build...
Copying icons if necessary
Copying icon C:\Users\corey\AppData\Local\Temp\nativefier-14-43-7-iconinfer--6816-JSmxNAZtkYK5\icon.ico to C:\Program Files\Nativefier\Messages by Google-win32-x64\resources\app\icon.ico
App built to C:\Program Files\Nativefier\Messages by Google-win32-x64 , move it wherever it makes sense for you and run the contained .exe file.

Expected behavior
I wouldn't see code.
Also, that the Notification would slide off screen (which it does) and then go into the Windows Notification Center (which it does not).
Actual behavior
I saw code. Notification disappears and does not go into the Notification/Action Center.
Context

Nativefier: 10.1.0
Node.js: v12.18.4
Npm: 6.14.8
OS: Windows 10 Pro 20H2 - 19042.541

Closing comment (2020-09-29T12:31:15Z): Thanks for the report. Closing as probably a dup of #1036 , and enriching it by mentioning notifications are affected too.