Cli: force:auth:jwt:grant / force:mdapi:deploy failing in 7.88.4 / 51.0.4 - FILE HAS NO CONTENT

Created on 23 Feb 2021  路  14Comments  路  Source: forcedotcom/cli

Summary

Since 7.88.4 / 51.0.4 running force:mdapi:deploy after force:auth:jwt:grant is failing with the following error message:

Successfully authorized USERNAME with org ID ORGID
ERROR running force:mdapi:deploy:  Parse error in file /root/.sfdx/USERNAME.json on line 1
FILE HAS NO CONTENT

A subsequent deployment using the same alias works so my assumption is that maybe the writing of the auth info to the file hasn't completed by the time the deploy command runs? These commands are run one after another in our build tools.

I have tests that check our build scripts before publishing a docker container with new SFDX versions - the build scripts haven't changed, the tests haven't changed and the tests reliably fail at the same point so something must have changed around the auth commands or deploy commands (the auth commands seem more likely based on the error).

Steps To Reproduce:

Run force:mdapi:deploy immediately after a successful jwt authentication using force:auth:jwt:grant.

Expected result

Deploy command should initiate a deployment.

Actual result

Error, as above.

Additional information

SFDX CLI Version(to find the version of the CLI engine run sfdx --version):

SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)

@oclif/plugin-autocomplete 0.3.0 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.2.2 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.9.5 (core)
@oclif/plugin-update 1.4.0-2 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.6.0 (core)
alias 1.1.5 (core)
auth 1.4.8 (core)
config 1.2.4 (core)
generator 1.1.5 (core)
salesforcedx 51.0.4 (core)
鈹溾攢 limits 1.0.4 (core)
鈹溾攢 user 1.1.2 (core)
鈹溾攢 schema 1.0.4 (core)
鈹溾攢 custom-metadata 1.0.11 (core)
鈹溾攢 apex 0.1.4 (core)
鈹溾攢 @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
鈹溾攢 templates 51.2.0 (core)
鈹斺攢 salesforce-alm 51.0.2 (core)
sfdx-cli 7.88.4 (core)
sfdx-destruction 1.0.0-beta.3
telemetry 1.1.1 (core)

OS and version:

Issue found in our docker container - Alpine Linux (see makepositive/sfdx-ant:7.88.4-2.5 for the exact container).

bug

Most helpful comment

We are encountering the same issue as well since 22-Feb when trying the deploy and query command:
sfdx force:mdapi:deploy
sfdx force:data:soql:query

Version

  • sfdx version
    sfdx-cli/7.88.4 linux-x64 node-v14.5.0
  • sfdx plugins --core
    @oclif/plugin-autocomplete 0.3.0 (core)
    @oclif/plugin-commands 1.3.0 (core)
    @oclif/plugin-help 3.2.2 (core)
    @oclif/plugin-not-found 1.2.4 (core)
    @oclif/plugin-plugins 1.9.5 (core)
    @oclif/plugin-update 1.4.0-2 (core)
    @oclif/plugin-warn-if-update-available 1.7.0 (core)
    @oclif/plugin-which 1.0.3 (core)
    @salesforce/sfdx-trust 3.6.0 (core)
    acn 1.1.4 (link) /home/jenkins/sfdxplugin
    alias 1.1.7 (core)
    auth 1.4.8 (core)
    config 1.2.5 (core)
    generator 1.1.5 (core)
    salesforcedx 51.0.4 (core)
    鈹溾攢 limits 1.0.4 (core)
    鈹溾攢 schema 1.0.4 (core)
    鈹溾攢 user 1.1.2 (core)
    鈹溾攢 apex 0.1.4 (core)
    鈹溾攢 custom-metadata 1.0.11 (core)
    鈹溾攢 templates 51.2.0 (core)
    鈹溾攢 @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
    鈹斺攢 salesforce-alm 51.0.2 (core)
    sfdx-cli 7.88.4 (core)

Error

  • sfdx force:mdapi:deploy -d dist/deployment-package -u * -c --json --loglevel debug
    {
    "status": 1,
    "name": "Error",
    "message": "Parse error in file /home/jenkins/.sfdx/
    username.json on line 1nFILE HAS NO CONTENTn",
    "exitCode": 1,
    "commandName": "MdapiDeployCommand",
    "stack": "Error: Parse error in file /home/jenkins/.sfdx/
    username
    *.json on line 1nFILE HAS NO CONTENTnn
    .

We even tried to display the contents of the username.json and it wasn't empty as indicated by the error:
image

I too noticed the issue frequently and randomly on docker container - Alpine Linux. Happening with the upgrade of sfdx-cli to latest, latest-rc or even the downgraded 7.83.0

All 14 comments

Git2Gus App is installed but the .git2gus/config.json doesn't have right values. You should add the required configuration.

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.

We also faced this issue with version 7.86.3 / 50.16.1 running force:source:deploy right after after a successful jwt authentication using force:auth:jwt:grant.

Additional info:

sfdx-cli/7.86.3 linux-x64 node-v12.16.2

@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.2.2 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.9.5 (core)
@oclif/plugin-update 1.3.10 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.6.0 (core)
alias 1.1.5 (core)
analytics 1.12.1 (core)
auth 1.4.7 (core)
config 1.2.4 (core)
generator 1.1.5 (core)
salesforcedx 50.16.1 (core)
鈹溾攢 limits 1.0.3 (core)
鈹溾攢 schema 1.0.3 (core)
鈹溾攢 user 1.0.11 (core)
鈹溾攢 apex 0.1.4 (core)
鈹溾攢 custom-metadata 1.0.11 (core)
鈹溾攢 templates 50.4.0 (core)
鈹溾攢 @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
鈹斺攢 salesforce-alm 50.16.1 (core)
sfdx-cli 7.86.3 (core)
telemetry 1.0.1 (core)

Same issue is happening to me with 7.88.4 / 51.0.4

Workaround: add a try/catch in the deployment pipeline and run the deploy command again (I added a loop that retries max 10 times with 5 sec interval).

I ran sfdx force:org:list between sfdx force:auth:jwt:grant and sfdx force:org:create
and it worked for me.

Im also running it in my build steps of the CI

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.

the same issue on v.7.70.1

Same issue here on v7.88.4 when trying to deploy with force:source:deploy -p

2021-02-24T10:08:46.6508668Z {
2021-02-24T10:08:46.6509586Z   "status": 1,
2021-02-24T10:08:46.6510198Z   "name": "Error",
2021-02-24T10:08:46.6510931Z   "message": "Parse error in file /home/vsts/.sfdx/[email protected] on line 1\nFILE HAS NO CONTENT\n",
2021-02-24T10:08:46.6511921Z   "exitCode": 1,
2021-02-24T10:08:46.6512583Z   "commandName": "SourceDeployReportCommand",
2021-02-24T10:08:46.6521166Z   "stack": "Error: Parse error in file /home/vsts/.sfdx/[email protected] on line 1\nFILE HAS NO CONTENT\n\n    at _checkEmptyContent (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/core/srcDevUtil.js:58:19)\n    at /opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/lib/core/srcDevUtil.js:88:21\n    at tryCatcher (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/bluebird/js/release/util.js:16:23)\n    at Promise._settlePromiseFromHandler (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/bluebird/js/release/promise.js:547:31)\n    at Promise._settlePromise (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/bluebird/js/release/promise.js:604:18)\n    at Promise._settlePromiseCtx (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/bluebird/js/release/promise.js:641:10)\n    at _drainQueueStep (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/bluebird/js/release/async.js:97:12)\n    at _drainQueue (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/bluebird/js/release/async.js:86:9)\n    at Async._drainQueues (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/bluebird/js/release/async.js:102:5)\n    at Immediate.Async.drainQueues [as _onImmediate] (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/bluebird/js/release/async.js:15:14)\n    at processImmediate (internal/timers.js:461:21)\nOuter stack:\n    at Function.wrap (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/@salesforce/core/lib/sfdxError.js:171:27)\n    at SourceDeployReportCommand.catch (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/salesforce-alm/dist/ToolbeltCommand.js:248:46)\n    at async SourceDeployReportCommand._run (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/@salesforce/command/lib/sfdxCommand.js:85:13)\n    at async Config.runCommand (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/@oclif/config/lib/config.js:173:24)\n    at async Main.run (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/@oclif/command/lib/main.js:27:9)\n    at async Main._run (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/node_modules/@oclif/command/lib/command.js:43:20)\n    at async Object.run (/opt/hostedtoolcache/node/14.15.5/x64/lib/node_modules/sfdx-cli/dist/cli.js:114:21)",

We are encountering the same issue as well since 22-Feb when trying the deploy and query command:
sfdx force:mdapi:deploy
sfdx force:data:soql:query

Version

  • sfdx version
    sfdx-cli/7.88.4 linux-x64 node-v14.5.0

  • sfdx plugins --core
    @oclif/plugin-autocomplete 0.3.0 (core)
    @oclif/plugin-commands 1.3.0 (core)
    @oclif/plugin-help 3.2.2 (core)
    @oclif/plugin-not-found 1.2.4 (core)
    @oclif/plugin-plugins 1.9.5 (core)
    @oclif/plugin-update 1.4.0-2 (core)
    @oclif/plugin-warn-if-update-available 1.7.0 (core)
    @oclif/plugin-which 1.0.3 (core)
    @salesforce/sfdx-trust 3.6.0 (core)
    acn 1.1.4 (link) /home/jenkins/sfdxplugin
    alias 1.1.7 (core)
    auth 1.4.8 (core)
    config 1.2.5 (core)
    generator 1.1.5 (core)
    salesforcedx 51.0.4 (core)
    鈹溾攢 limits 1.0.4 (core)
    鈹溾攢 schema 1.0.4 (core)
    鈹溾攢 user 1.1.2 (core)
    鈹溾攢 apex 0.1.4 (core)
    鈹溾攢 custom-metadata 1.0.11 (core)
    鈹溾攢 templates 51.2.0 (core)
    鈹溾攢 @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
    鈹斺攢 salesforce-alm 51.0.2 (core)
    sfdx-cli 7.88.4 (core)

Error

  • sfdx force:mdapi:deploy -d dist/deployment-package -u * -c --json --loglevel debug
    {
    "status": 1,
    "name": "Error",
    "message": "Parse error in file /home/jenkins/.sfdx/
    username.json on line 1nFILE HAS NO CONTENTn",
    "exitCode": 1,
    "commandName": "MdapiDeployCommand",
    "stack": "Error: Parse error in file /home/jenkins/.sfdx/
    username
    *.json on line 1nFILE HAS NO CONTENTnn
    .

We even tried to display the contents of the username.json and it wasn't empty as indicated by the error:
image

Temporarily rolling back to [email protected] and [email protected] seems to work for us while waiting for the issue with [email protected] to be fixed.

Rolling all the way back to [email protected] resolved it on my end

A new version of the @salesforce/core library (v2.20.1) was published that fixes the issue for npm installs of sfdx-cli. If you are installing from npm please try again as it should use the latest version of the core library which fixes it. Not sure if you have to first uninstall but that might be good to ensure it grabs 2.20.1.

We are encountering the same issue as well since 22-Feb when trying the deploy and query command:
sfdx force:mdapi:deploy
sfdx force:data:soql:query

Version

  • sfdx version
    sfdx-cli/7.88.4 linux-x64 node-v14.5.0
  • sfdx plugins --core
    @oclif/plugin-autocomplete 0.3.0 (core)
    @oclif/plugin-commands 1.3.0 (core)
    @oclif/plugin-help 3.2.2 (core)
    @oclif/plugin-not-found 1.2.4 (core)
    @oclif/plugin-plugins 1.9.5 (core)
    @oclif/plugin-update 1.4.0-2 (core)
    @oclif/plugin-warn-if-update-available 1.7.0 (core)
    @oclif/plugin-which 1.0.3 (core)
    @salesforce/sfdx-trust 3.6.0 (core)
    acn 1.1.4 (link) /home/jenkins/sfdxplugin
    alias 1.1.7 (core)
    auth 1.4.8 (core)
    config 1.2.5 (core)
    generator 1.1.5 (core)
    salesforcedx 51.0.4 (core)
    鈹溾攢 limits 1.0.4 (core)
    鈹溾攢 schema 1.0.4 (core)
    鈹溾攢 user 1.1.2 (core)
    鈹溾攢 apex 0.1.4 (core)
    鈹溾攢 custom-metadata 1.0.11 (core)
    鈹溾攢 templates 51.2.0 (core)
    鈹溾攢 @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
    鈹斺攢 salesforce-alm 51.0.2 (core)
    sfdx-cli 7.88.4 (core)

Error

  • sfdx force:mdapi:deploy -d dist/deployment-package -u * -c --json --loglevel debug
    {
    "status": 1,
    "name": "Error",
    "message": "Parse error in file /home/jenkins/.sfdx/
    username.json on line 1nFILE HAS NO CONTENTn",
    "exitCode": 1,
    "commandName": "MdapiDeployCommand",
    "stack": "Error: Parse error in file /home/jenkins/.sfdx/
    username
    *.json on line 1nFILE HAS NO CONTENTnn
    .

We even tried to display the contents of the username.json and it wasn't empty as indicated by the error:
image

I too noticed the issue frequently and randomly on docker container - Alpine Linux. Happening with the upgrade of sfdx-cli to latest, latest-rc or even the downgraded 7.83.0

Was this page helpful?
0 / 5 - 0 ratings