forge: MacOS: code has no resources but signature indicates they must be present

Pre-flight checklist

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

Electron Forge version

6.0.4

Electron version

v22.0.0

Operating system

macOS Ventura (ARM)

Last known working Electron Forge version

last beta version

Expected behavior

codesign --verify --deep --strict out/MyApp-darwin-arm64/MyApp.app   # should output:
/Users/wyattblue/projects/app/out/MyApp-darwin-arm64/MyApp.app: code object is not signed at all

Actual behavior

codesign --verify --deep --strict out/MyApp-darwin-arm64/MyApp.app  # should output:
/Users/wyattblue/projects/app/out/MyApp-darwin-arm64/MyApp.app: code has no resources but signature indicates they must be present

Steps to reproduce

Run yarn package on a skeleton project on MacOS Arm

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

For anyone that finds this in the future. Here’s how I fixed this (after 10 hours of debugging):

osxSign: {
    identity: 'Apple Development: XXX (XXX)',
},

Fill in the blanks with the values from: security find-identity -p codesigning -v.

I did some testing, and the found that the problem is with osx-electron-sign itself. I had to specify identity with my Apple Developer account, since it complains about not finding a valid identity but it’s now working for me!

One thing you can do on your end is document the fact that signing takes place before the postPackage hooks so any code that minifies or removes files will invalidate the sign. I had to move that code to the packageAfterCopy hook. Here’s the forge.config.js I’m using

module.exports = {
  hooks: {
    packageAfterCopy: async (forgeConfig, build_path) => {
      console.log(`\nBuild Path: ${build_path}`);
      await minify(build_path + '/src');
    },
  },
  packagerConfig: {
    icon: "./assets/icon",
    osxSign: {
      "identity": process.env.SIGN_ID,
    },
...

I consider this issue resolved on electron-forge’s end.

Seems to be happening still, I followed the guide on Electron Forge, but get the error when running package or make commands.

I did some testing, and the found that the problem is with osx-electron-sign itself. I had to specify identity with my Apple Developer account, since it complains about not finding a valid identity but it’s now working for me!

One thing you can do on your end is document the fact that signing takes place before the postPackage hooks so any code that minifies or removes files will invalidate the sign. I had to move that code to the packageAfterCopy hook. Here’s the forge.config.js I’m using

module.exports = {
  hooks: {
    packageAfterCopy: async (forgeConfig, build_path) => {
      console.log(`\nBuild Path: ${build_path}`);
      await minify(build_path + '/src');
    },
  },
  packagerConfig: {
    icon: "./assets/icon",
    osxSign: {
      "identity": process.env.SIGN_ID,
    },
...

I consider this issue resolved on electron-forge’s end.

I had this exact same issue resulting in notarization failure with:

CloudKit query for [app] failed due to "Record not found".
Could not find base64 encoded ticket in response for [id]
The staple and validate action failed! Error 65.

I had to add the sign identity specifically to the config. In this case the docs on the site were misleading and it failed without any error, only finally failing at the notarize step.

Not sure if these issues are related:

In my case, it was lack of these two certifacation:

Developer ID - G2 (Expiring 09/17/2031 00:00:00 UTC) Apple Inc. Root

download from apple official site: https://www.apple.com/certificateauthority/

Install these two first, then install your developer certifacation.

Noted. We should definitely document the package flow a bit better I think.