forge icon indicating copy to clipboard operation
forge copied to clipboard

"quiet" package option can not be override

Open jdeniau opened this issue 1 year ago • 1 comments

Pre-flight checklist

  • [X] I have read the contribution documentation for this project.
  • [X] I agree to follow the code of conduct that this project uses.
  • [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

7.2.0

Electron version

28.2.3

Operating system

macOS 14.3.1

Last known working Electron Forge version

No response

Expected behavior

I'd like the packagerConfig.quiet to be default to true, or at least to let me change it's value.

Actually it's "locked" by the following lines :

https://github.com/electron/forge/blob/3c5bf3d5cf1f35988a95b1e2ccde4bb9af06b3a8/packages/api/core/src/api/package.ts#L305-L317

(both lines 305 and 317 do force the value to false after the custom user configuration).

Actual behavior

When trying to sign the app, I got issues that I could not debug without having to go deep into the code and console.log things

I used both DEBUG=electron-osx-sign* and DEBUG=electron-notarize*, but I still struggled at some point (see below).

Steps to reproduce

I do not know if you can reproduce this, but I can show the deep dive I had to do (quick version).

For the record, with the same configuration, I had no issue on a mac "x64".

When trying to sign and notarize a mac app, when running yarn make, I got the following output

[STARTED] Packaging for arm64 on darwin
[STARTED] Copying files
[SUCCESS] Copying files
[STARTED] Preparing native dependencies
[TITLE] Preparing native dependencies
[SUCCESS] Preparing native dependencies
[STARTED] Finalizing package
2024-03-17T20:11:59.644Z electron-osx-sign [email protected]
2024-03-17T20:11:59.645Z electron-osx-sign `identity` passed in arguments.
2024-03-17T20:11:59.645Z electron-osx-sign Executing... security find-identity -v
[FAILED] Failed to codesign your application with code: 1
[FAILED] 
[FAILED] Tiana Tables.app: code has no resources but signature indicates they must be present
[FAILED] 
[FAILED] 

By running with DEBUG=electron-osx-sign*, the last log I got was Walking... from https://github.com/electron/osx-sign/blob/97b1e13b9a6de43a5add8dccf609ac10a780b1e8/src/util.ts#L136

I tried adding a line just bellow and nothing was displayed.

I added a try / catch, and then I got an issue displayed with EMFILE: too many open files (but that's not the point of this issue).

By going up with this, I found that all error send in the signApp, will be throwned to the caller (as mentioned in the documentation).

I then went into the packager package, that does call signApp here where there is a continueOnError option

https://github.com/electron/packager/blob/d5cd2b7dcd8e85c1c1bdcdd3c4e77edc9ac729f2/src/mac.ts#L404-L414

I tried to add this option into my osxSign option, but TypeScript does throw with

Object literal may only specify known properties, and 'continueOnError' does not exist in type 'OsxSignOptions'.ts(2353)

I continue to dive as I did not saw neither the error, nor the warning message "Code sign failed; please retry manually"

In the warning function, we do nothing when the quiet option is true : https://github.com/electron/packager/blob/d5cd2b7dcd8e85c1c1bdcdd3c4e77edc9ac729f2/src/common.ts#L30

I tried to set the quiet option in my packagerConfig object. TypeScript is OK with this, still no log.

image

As I said in the "Expected behavior" section, it's locked here https://github.com/electron/forge/blob/3c5bf3d5cf1f35988a95b1e2ccde4bb9af06b3a8/packages/api/core/src/api/package.ts#L305-L317

Additional information

I would like your input about if this is intended, if I could open a PR that either allow "quiet" to be changed, or if "true" should be the default value (or both).

For the record, the quiet option has been added in https://github.com/electron/forge/pull/8 by @malept 8 years ago.

jdeniau avatar Mar 18 '24 08:03 jdeniau

I also agree that this should have been an optional parameter that could have been set by the config. I dealt with a lot of issues that I had no starting point for, only seeing this issue let me create a shim to override it. This would have saved me a lot of time. I also don't understand the decision to have Continue on error forced on Osx sign then to continue onto OSx-notarize. You will NEVER be able to notarize a package with a failed codesign output, and in my opinion it should just throw an error there.

KenCorma avatar Sep 27 '24 20:09 KenCorma

I'm not opposed to making this behaviour configurable and just defaulting to quiet by default :)

erickzhao avatar Jan 31 '25 07:01 erickzhao