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

Notarize failed with 24.13.3 after upgrade from 24.12.0 with app specific password #8103

Closed
KillerCodeMonkey opened this issue Mar 6, 2024 · 11 comments
Labels

Comments

@KillerCodeMonkey
Copy link

KillerCodeMonkey commented Mar 6, 2024

  • Electron-Builder Version: 24.13.3
  • Node Version: 18.18.2
  • Electron Version: 28.2.5
  • Electron Type (current, beta, nightly): stable
  • Target: macos-12 dmg darwin-64

I upgraded electron builder from 24.12.0 to 24.13.3 and notarizing failed with

Cannot destructure property 'appBundleId' of 'options' as it is undefined. 

I am using APPLE_ID and APPLE_APP_SPECIFIC_PASSWORD approach for authorization.
Since i did not find out what changed, i tried to force new notarytool.

I checked the code how notarize options are build. And it should be possible to set

{
  mac: {
    notarize: {
      teamId: "TEAM_ID"
    }
  }
}

even when using apple id and app specific password for authorization. the new notarytool should be used following the source code in https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/macPackager.ts#L566. But when setting the team id i get this:

-> Options related to how build macOS targets.
   Details:
    * configuration.mac.notarize has an unknown property 'teamId'. These properties are valid:
      object { appBundleId?, ascProvider? }
    * configuration.mac.notarize has an unknown property 'tool'. These properties are valid:
      object { appBundleId?, ascProvider? }
    * configuration.mac.notarize has an unknown property 'tool'. These properties are valid:
      object { teamId }
    * configuration.mac.notarize misses the property 'teamId'. Should be:
      string
      -> The team ID you want to notarize under for when using `notarytool`

So what did i miss in the version update that notarizing is not working anymore?

Thank you!

EDIT: Downgraded to 24.12.0 again and removed the notarize key from the builder config. and it is working again.

Cirras added a commit to Cirras/eomap-js that referenced this issue Mar 6, 2024
@KillerCodeMonkey
Copy link
Author

I switched to api keys to get things working with latest builder version.
but i guess the issue is still valid

@brianpetro
Copy link

I also had to downgrade to get things rolling again.

It seems that in v24.13.3, notarize is being called somewhere while disregarding the script specified by afterSign.

The error I was getting: Cannot destructure property 'appBundleId' of 'options' as it is undefined. failedTask=build stackTrace=TypeError: Cannot destructure property 'appBundleId' of 'options' as it is undefined..

It seems like this "other" notarize is being called based on a trigger other than the afterSign config.

@yudai
Copy link

yudai commented Mar 27, 2024

I hit the same issue that reported here.

Newer electron-builder has a built-in notarize option that works out of the box as @KillerCodeMonkey mentioned. On the other hand, the old way that uses the afterSign option to invoke a script to manually call electron-notarize doesn't work well with electron-builder 24.13.3.

I removed the afterSign option in my script and added the following config to package.json and now everything works without issues. I'm still using APPLE_APP_SPECIFIC_PASSWORD, but it looks that's just fine.

...under mac..
     "notarize": {
        "teamId": "YOUR_TEAM_ID"
      }

@sandeep1995
Copy link
Contributor

If you have the following env variables, it will try to notarize automatically

  1. APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER.
  2. APPLE_ID, APPLE_APP_SPECIFIC_PASSWORD, and APPLE_TEAM_ID
  3. APPLE_KEYCHAIN and APPLE_KEYCHAIN_PROFILE

mtsdnz added a commit to gethubai/hubai-desktop that referenced this issue Apr 15, 2024
@slhck
Copy link
Contributor

slhck commented Apr 25, 2024

the afterSign option to invoke a script to manually call electron-notarize doesn't work well with electron-builder 24.13.3

How so?

I am still using this approach and it works fine. Just ensure to set build.mac.notarize to false in package.json, to avoid attempting it twice.

Here is my afterSign.js file, set in build.afterSign. Note that I load the credentials from a file using dotenv; I do not pass them via runtime environment variables:

const path = require('path');
require('dotenv').config();
require('dotenv').config({ path: path.resolve(__dirname, '..', '..', '.credentials') });
const { spawnSync } = require('child_process');
const { notarize } = require('@electron/notarize');

async function notarizeMacos(context) {
  const { appOutDir } = context;

  const {
    APPLE_ID,
    APPLE_APP_SPECIFIC_PASSWORD,
    APPLE_TEAM_ID,
  } = process.env;

  if (!(APPLE_ID && APPLE_APP_SPECIFIC_PASSWORD && APPLE_TEAM_ID)) {
    console.log('Skipping notarizing step. APPLE_ID, APPLE_APP_SPECIFIC_PASSWORD, and APPLE_TEAM_ID env variables must be set');
    return;
  }

  if (process.env.SKIP_NOTARIZE !== undefined) {
    console.warn('Skipping notarizing step. SKIP_NOTARIZE env variable is set.');
    return;
  }

  const appName = context.packager.appInfo.productFilename;

  console.log('Notarizing macOS app...');
  await notarize({
    // appBundleId: build.appId,
    appPath: `${appOutDir}/${appName}.app`,
    appleId: APPLE_ID,
    appleIdPassword: APPLE_APP_SPECIFIC_PASSWORD,
    teamId: APPLE_TEAM_ID,
  });
}

exports.default = async function notarizeOrSign(context) {
  const { electronPlatformName } = context;
  if (electronPlatformName === 'darwin') {
    await notarizeMacos(context);
  } else {
    console.log(`No notarization or signing for platform ${electronPlatformName}`);
  }
};

@shangzhenyang
Copy link

I hit the same issue that reported here.

Newer electron-builder has a built-in notarize option that works out of the box as @KillerCodeMonkey mentioned. On the other hand, the old way that uses the afterSign option to invoke a script to manually call electron-notarize doesn't work well with electron-builder 24.13.3.

I removed the afterSign option in my script and added the following config to package.json and now everything works without issues. I'm still using APPLE_APP_SPECIFIC_PASSWORD, but it looks that's just fine.

...under mac..
     "notarize": {
        "teamId": "YOUR_TEAM_ID"
      }

It works! Thank you!

@greggman
Copy link

greggman commented May 28, 2024

@sandeep1995

  • APPLE_ID, APPLE_APP_SPECIFIC_PASSWORD, and APPLE_TEAM_ID

This is not working for me

[email protected] APPLE_TEAM_ID=W00ABCDEFG APPLE_APP_SPECIFIC_PASSWORD=xxxx-yyyy-zzzz-wwww ....

The teamId property is required when using notarization with password credentials failedTask=build stackTrace=Error: The teamId property is required when using notarization with password credentials

"electron-builder": "^24.13.3"

I don't have an afterSign script.

@nunyvega
Copy link

nunyvega commented Jun 7, 2024

"notarize": {
"teamId": "YOUR_TEAM_ID"
}

It works! Thanks!

@talhaibnmahmud
Copy link

talhaibnmahmud commented Jun 10, 2024

I hit the same issue that reported here.

Newer electron-builder has a built-in notarize option that works out of the box as @KillerCodeMonkey mentioned. On the other hand, the old way that uses the afterSign option to invoke a script to manually call electron-notarize doesn't work well with electron-builder 24.13.3.

I removed the afterSign option in my script and added the following config to package.json and now everything works without issues. I'm still using APPLE_APP_SPECIFIC_PASSWORD, but it looks that's just fine.

...under mac..
     "notarize": {
        "teamId": "YOUR_TEAM_ID"
      }

I added it in my electron-builder.ts

also set the envs APPLE_ID & APPLE_APP_SPECIFIC_PASSWORD and it is working again.

Note: If you have an older afterSign script, you will probably want to turn that off as electron-builder will now try to automatically notarize the app for you

Copy link
Contributor

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Aug 10, 2024
benoitf added a commit to benoitf/desktop that referenced this issue Aug 14, 2024
benoitf added a commit to benoitf/desktop that referenced this issue Aug 14, 2024
benoitf added a commit to podman-desktop/podman-desktop that referenced this issue Aug 15, 2024
amisskii pushed a commit to amisskii/podman-desktop that referenced this issue Aug 21, 2024
Copy link
Contributor

github-actions bot commented Sep 9, 2024

This issue was closed because it has been stalled for 30 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants