forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
491 stars 79 forks source link

Deploy error: Converting circular structure to JSON #1518

Closed 0xRoch closed 2 years ago

0xRoch commented 2 years ago

Summary

An error started appearing in SFDX deployments, it doesn't block the deployment but triggers an error in our CI.

Steps To Reproduce:

sfdx force:mdapi:deploy --loglevel debug --verbose --targetusername PROD --deploydir artifacts/${PACKAGE_NAME} --testlevel RunLocalTests --wait ${SFDX_TIMEOUT} --soapdeploy

Expected result

Success / no errors

Actual result


ERROR running force:mdapi:deploy:  Converting circular structure to JSON
    --> starting at object with constructor 'Connection'
    |     property 'analytics' -> object with constructor 'Analytics'
    --- property '_conn' closes the circle```
github-actions[bot] commented 2 years ago

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.

iditente commented 2 years ago

I've also the same issue. Working fine with the previous version (salesforce/salesforcedx:7.149.1-full).

mshanemc commented 2 years ago

@iditente @D-Roch if you've got a repo that you can share that reproduces this error, that would help a lot.

other question: if you look in the org, is the deployment failing or succeeding? @D-Roch can you provide the output of sfdx version --verbose so we can check the plugins?

iditente commented 2 years ago

@mshanemc , we are using the latest-full version of the sfdx docker image. We can reproduce it locally with this version :

sfdx version --verbose CLI Version : sfdx-cli/7.150.0

Architecture: darwin-x64

Node Version : node-v16.15.0

Plugin Version: @oclif/plugin-autocomplete 0.3.0 (core) @oclif/plugin-commands 1.3.0 (core) @oclif/plugin-help 3.3.1 (core) @oclif/plugin-not-found 1.2.6 (core) @oclif/plugin-plugins 1.10.11 (core) @oclif/plugin-update 1.5.0 (core) @oclif/plugin-warn-if-update-available 1.7.3 (core) @oclif/plugin-which 1.0.4 (core) @salesforce/lwc-dev-server 2.11.0 @salesforce/sfdx-diff 0.0.6 @salesforce/sfdx-plugin-lwc-test 0.1.7 (core) alias 2.0.0 (core) apex 0.11.0 (core) auth 2.0.2 (core) community 1.1.4 (core) config 1.4.6 (core) custom-metadata 1.1.0 (core) data 0.6.15 (core) generator 2.0.0 (core) info 2.0.0 (core) limits 2.0.0 (core) org 1.12.1 (core) salesforce-alm 54.3.0 (core) schema 2.1.0 (core) sfdx-browserforce-plugin 0.0.0-development (link) /Users/mdk/Git/sfdx-browserforce-plugin sfdx-cli 7.150.0 (core) sfdx-djc-plugin 0.0.31 sfdx-git-packager 0.3.3 sfpowerkit 2.1.5 (link) /Users/mdk/Git/sfpowerkit shane-sfdx-plugins 1.1.3 (link) /Users/mdk/Git/shane-sfdx-plugins sico-sfdx-plugin 1.0.0 (link) /Users/mdk/SFDCdevops/git/sico-sfdx-plugin signups 1.0.0 (core) source 1.9.7 (core) telemetry 1.4.0 (core) templates 54.6.0 (core) texei-sfdx-plugin 1.9.0 (link) /Users/mdk/Git/texei-sfdx-plugin trust 1.1.0 (core) user 1.7.1 (core)

OS and Version: Darwin 21.4.0

mshanemc commented 2 years ago

hmm...that kinda looks like it's coming from inside jsforce but I can't imagine why that would be called during a deploy.

Can you humor me and temporarily uninstall your linked plugins so that we know it's something the core CLI plugins (vs. a hook executing, for example)

iditente commented 2 years ago

I've run the bitbucket pipeline with salesforce/salesforcedx:latest-full image and without our custom sfdx plugins with just the profiles in the package. See the result below :

-> Cleaning profile › Warning: sico:clean:profile is not a sfdx command.

-> Cleaning packageVersions Did you mean autocomplete:create? [y/n]: › Warning: sico:clean:packageVersions is not a sfdx command.

-> Converting ApexTestSuite Metadata, tests class to run are : Did you mean force:package:version:list? [y/n]: › Warning: sico:apextestsuite:convert is not a sfdx command.

-> Aunthenticating to the Org Did you mean force:source:convert? [y/n]: You acknowledge and agree that the CLI tool may collect usage information, user environment, and crash reports for the purposes of providing services or functions that are relevant to use of the CLI tool and product improvements. Successfully authorized sfdc@c43.fr.integ with org ID 00D4E0000008nfQUAQ

-> Converting Source format to Metadata API format Source was successfully converted to Metadata API format and written to the location: /opt/atlassian/pipelines/agent/build/deploystage

-> Copying Destructive Changes Xml files in deploystage directory

-> Validate with specified tests ERROR running force:mdapi:deploy: Converting circular structure to JSON --> starting at object with constructor 'Connection' | property 'analytics' -> object with constructor 'Analytics' --- property '_conn' closes the circle ERROR running force:mdapi:deploy:report: The provided ID is invalid, deploy IDs must start with '0Af'.

iditente commented 2 years ago

Same test with the salesforce/salesforcedx:7.149.1-full image :

-> Cleaning profile › Warning: sico:clean:profile is not a sfdx command.

-> Cleaning packageVersions Did you mean autocomplete:create? [y/n]: › Warning: sfdx-cli update available from 7.149.1 to 7.150.0. › Warning: sico:clean:packageVersions is not a sfdx command.

-> Converting ApexTestSuite Metadata, tests class to run are : Did you mean force:package:version:list? [y/n]: › Warning: sfdx-cli update available from 7.149.1 to 7.150.0. › Warning: sico:apextestsuite:convert is not a sfdx command.

-> Aunthenticating to the Org Did you mean force:source:convert? [y/n]: › Warning: sfdx-cli update available from 7.149.1 to 7.150.0. You acknowledge and agree that the CLI tool may collect usage information, user environment, and crash reports for the purposes of providing services or functions that are relevant to use of the CLI tool and product improvements. Successfully authorized sfdc@c43.fr.integ with org ID 00D4E0000008nfQUAQ

-> Converting Source format to Metadata API format › Warning: sfdx-cli update available from 7.149.1 to 7.150.0. Source was successfully converted to Metadata API format and written to the location: /opt/atlassian/pipelines/agent/build/deploystage

-> Copying Destructive Changes Xml files in deploystage directory

-> Validate with specified tests › Warning: sfdx-cli update available from 7.149.1 to 7.150.0. MDAPI PROGRESS | ████████████████████████████████████████ | 0/0 Components MDAPI PROGRESS | ████████████████████████████████████████ | 0/0 Components MDAPI PROGRESS | ████████████████████████████████████████ | 0/0 Components MDAPI PROGRESS | ████████████████████████████████████████ | 0/0 Components MDAPI PROGRESS | ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ | 1/20 Components MDAPI PROGRESS | ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ | 1/20 Components MDAPI PROGRESS | ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ | 1/20 Components MDAPI PROGRESS | ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ | 1/20 Components MDAPI PROGRESS | ████████████████████████████████████████ | 20/20 Components MDAPI PROGRESS | ████████████████████████████████████████ | 20/20 Components MDAPI PROGRESS | ████████████████████████████████████████ | 20/20 Components MDAPI PROGRESS | ████████████████████████████████████████ | 20/20 Components MDAPI PROGRESS | ████████████████████████████████████████ | 20/20 Components MDAPI PROGRESS | ████████████████████████████████████████ | 20/20 Components

iowillhoit commented 2 years ago

I was able to reproduce this also. Running the a basic mdapi deploy with either DEBUG=* or --loglevel debug

Screen Shot 2022-05-16 at 1 17 08 PM
uip-robot-zz commented 2 years ago

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

iowillhoit commented 2 years ago

@D-Roch We will look into getting this sorted. In the meantime you should be able to run this command successfully by removing the --loglevel debug (or DEBUG=*) from the command.

0xRoch commented 2 years ago

Thank you, salesforce/salesforcedx:7.149.1-full fixed it for now on our side

iowillhoit commented 2 years ago

The sfdx version with this fix has been promoted to latest (7.151.1). Thanks for your patience while we got this fixed!