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

sf package version create output doesn't contain an ID to continue polling when --wait is hit #2605

Closed
stuartgrieve opened this issue Dec 13, 2023 · 7 comments · Fixed by forcedotcom/packaging#485
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue validated Version information for this issue has been validated

Comments

@stuartgrieve
Copy link

stuartgrieve commented Dec 13, 2023

Summary

Our package version creation can take a while when we run all tests. Bitbucket sets a limit of 120 minutes on pipelines, so we've added a --wait of 110 to make sure the command concludes gracefully before being cut off.

I was expecting this to return an ID which we could later query with package version creation report, but I get the following JSON output:

{
  "code": 1,
  "context": "PackageVersionCreateCommand",
  "commandName": "PackageVersionCreateCommand",
  "message": "The client has timed out.",
  "name": "PollingClientTimeout",
  "status": 1,
  "stack": "PollingClientTimeout: The client has timed out.\n    at PollingClient.subscribe (/usr/local/lib/nodejs/lib/node_modules/@salesforce/cli/node_modules/@salesforce/core/lib/status/pollingClient.js:91:19)\n    at async PackageVersion.pollCreateStatus (/usr/local/lib/nodejs/lib/node_modules/@salesforce/cli/node_modules/@salesforce/packaging/lib/package/packageVersion.js:191:20)\n    at async PackageVersionCreateCommand.run (/usr/local/lib/nodejs/lib/node_modules/@salesforce/cli/node_modules/@salesforce/plugin-packaging/lib/commands/package/version/create.js:60:24)\n    at async PackageVersionCreateCommand._run (/usr/local/lib/nodejs/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/command.js:304:22)\n    at async Config.runCommand (/usr/local/lib/nodejs/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:417:25)\n    at async run (/usr/local/lib/nodejs/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/main.js:85:16)",
  "exitCode": 1,
  "warnings": []
}

Steps To Reproduce

I can't provide a repository due to IP. Steps to reproduce:

  • Create a project with a somewhat large package directory (or long running tests)
  • Execute sf package version create --package <packageName> --installation-key <installationKey> --target-dev-hub <devHubAlias> --code-coverage --wait <waitTimeLessThanTheTotalPackagingTime> --json

Expected result

  • The output should contain an ID which we can use in package version create report (AFAIK this is how project deploy works when a deploy has not completed within the --wait time)

Actual result

  • Observe the output does not contain an ID and we have no way to query any failures.

System Information

Pipeline is using the docker image: salesforce/cli:nightly-full

sf version --verbose --json
{
  "architecture": "linux-x64",
  "cliVersion": "@salesforce/cli/2.22.5",
  "nodeVersion": "node-v20.10.0",
  "osVersion": "Linux 5.15.0-1050-aws",
  "rootPath": "/usr/local/lib/nodejs/lib/node_modules/@salesforce/cli",
  "shell": "bash",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.3 (core)",
    "@oclif/plugin-commands 3.0.7 (core)",
    "@oclif/plugin-help 6.0.8 (core)",
    "@oclif/plugin-not-found 3.0.5 (core)",
    "@oclif/plugin-plugins 4.1.10 (core)",
    "@oclif/plugin-search 1.0.8 (core)",
    "@oclif/plugin-update 4.1.5 (core)",
    "@oclif/plugin-version 2.0.9 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.6 (core)",
    "@oclif/plugin-which 3.0.12 (core)",
    "@salesforce/cli 2.22.5 (core)",
    "apex 3.0.8 (core)",
    "auth 3.0.12 (core)",
    "data 3.0.6 (core)",
    "deploy-retrieve 2.2.6 (core)",
    "info 3.0.8 (core)",
    "limits 3.0.6 (core)",
    "marketplace 1.0.11 (core)",
    "org 3.1.2 (core)",
    "packaging 1.27.8 (core)",
    "schema 3.0.8 (core)",
    "settings 2.0.9 (core)",
    "sobject 1.0.6 (core)",
    "source 3.0.3 (core)",
    "telemetry 3.1.6 (core)",
    "templates 56.0.4 (core)",
    "trust 3.2.0 (core)",
    "user 3.1.1 (core)"
  ]
}
@stuartgrieve stuartgrieve added the investigating We're actively investigating this issue label Dec 13, 2023
Copy link

Hello @stuartgrieve 👋 It looks like you didn't include the full Salesforce CLI version information in your issue.
Please provide the output of version --verbose --json for the CLI you're using (sf or sfdx).

A few more things to check:

  • Make sure you've provided detailed steps to reproduce your issue.
    • A repository that clearly demonstrates the bug is ideal.
  • Make sure you've installed the latest version of Salesforce CLI. (docs)
    • Better yet, try the rc or nightly versions. (docs)
  • Try running the doctor command to diagnose common issues.
  • Search GitHub for existing related issues.

Thank you!

@github-actions github-actions bot added more information required Issue requires more information or a response from the customer and removed investigating We're actively investigating this issue labels Dec 13, 2023
Copy link

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@github-actions github-actions bot added validated Version information for this issue has been validated investigating We're actively investigating this issue and removed more information required Issue requires more information or a response from the customer labels Dec 13, 2023
@iowillhoit
Copy link
Contributor

iowillhoit commented Dec 14, 2023

Note

Disregard this post, see my next comment 😄

Hey @stuartgrieve, I think this is working as designed. If we ignore the timeout and just run sf package version create [...] --json the default wait is 0. This will immediately return the json response. Which looks like this:

{
  "status": 0,
  "result": {
    "Id": "08cKY00000000euYAA",
    "Status": "Initializing",
    "Package2Id": "0HoKY00000000VJ0AY",
    "Package2VersionId": null,
    "SubscriberPackageVersionId": null,
    "Tag": null,
    "Branch": null,
    "Error": [],
    "CreatedDate": "2023-12-14 14:34",
    "HasMetadataRemoved": null,
    "CreatedBy": "00546000002jDFFAA2",
    "ConvertedFromVersionId": "Request is in progress. ID unavailable."
  },
  "warnings": []
}

Notice that the Package2VersionId is null. This is the id that you would pass to report to get details about it.

The help text for sf package version report --help says:

Retrieve details about the package version with the specified ID from your default Dev Hub org

I think that maybe display would have been a better command name. Like you mentioned, report is confusing because sf project deploy report functions exactly as you are expecting in this Issue.

Check or poll for the status of a deploy operation.

You could use sf package list --json and jq to look for the package version just tried to deploy.

@iowillhoit
Copy link
Contributor

Oh shoot sorry, I got confused on this... I was testing with package version report not package version create report :P

Yes, using package version create report you can pass in the Id of the json i shared in my last post and it gives you a status of the creation.

In which case, when a timeout happens it should definitely provide the Id so that you can check on it later. I was able to confirm it is not included in the error output. I will get a bug created. Thanks for posting

@iowillhoit iowillhoit added the bug Issue or pull request that identifies or fixes a bug label Dec 14, 2023
Copy link

git2gus bot commented Dec 14, 2023

This issue has been linked to a new work item: W-14670120

@stuartgrieve
Copy link
Author

Great, thanks @iowillhoit - glad I wasn't going crazy

@shetzel
Copy link
Contributor

shetzel commented Jan 18, 2024

The fix is now in the sf CLI release candidate v2.25.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug investigating We're actively investigating this issue validated Version information for this issue has been validated
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants