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

Getting errors when running "sfdx commerce:store:create": The \"-u\" flag has been deprecated. Use \"--target-org | -o\" instead.", "The \"--apiversion\" flag has been deprecated. Use \"--api-version\" instead. #315

Open
forcepulsar opened this issue May 15, 2024 · 0 comments

Comments

@forcepulsar
Copy link

forcepulsar commented May 15, 2024

running the command sfdx commerce:store:create to create b2b sites I get error.

ERROR running StoreQuickstartSetup:  {
    "code": 1,
    "context": "Create",
    "commandName": "Create",
    "message": "The requested resource does not exist",
    "name": "NOT_FOUND",
    "status": 1,
    "stack": "NOT_FOUND: The requested resource does not exist\n    at HttpApi.getError (/usr/local/lib/sf/node_modules/@jsforce/jsforce-node/lib/http-api.js:278:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async /usr/local/lib/sf/node_modules/@jsforce/jsforce-node/lib/http-api.js:127:33\n    at async Connection.create (/usr/local/lib/sf/node_modules/@jsforce/jsforce-node/lib/connection.js:719:15)\n    at async Create.run (file:///usr/local/lib/sf/node_modules/@salesforce/plugin-data/lib/commands/data/create/record.js:48:24)\n    at async Create._run (/usr/local/lib/sf/node_modules/@oclif/core/lib/command.js:311:22)\n    at async Config.runCommand (/usr/local/lib/sf/node_modules/@oclif/core/lib/config/config.js:433:25)\n    at async run (/usr/local/lib/sf/node_modules/@oclif/core/lib/main.js:92:16)",
    "exitCode": 1,
    "warnings": [
        "The \"-u\" flag has been deprecated. Use \"--target-org | -o\" instead.",
        "The \"--apiversion\" flag has been deprecated. Use \"--api-version\" instead."
    ],
    "command": "sfdx force:data:record:create -u \"[email protected]\" -s \"ShippingConfigurationSet\" -v \"TargetRecordId=0ZEHy0000000KNUOA2\" --json --apiversion=57.0"
}

I managed to make it run myself by building the package locally and updating the file /src/lib/utils/sfdx/forceDataSoql.ts on line 56. Replaced the line:

appendCommonFlags(`sfdx force:data:record:create ${u} -s "${service}" -v "${value}" --json`, flags, logger),

with the following (basically hardcoding the scratch name and using sf instead of sfdx):

appendCommonFlags(`sf data create record -o <<SCRATCH ORG NICKNAME>> -s "${service}" -v "${value}" --json`, flags, logger),

Note the <> has to be hardcoded to the scratch org nickname

Then I ran the command and it worked

./bin/run commerce:store:create -n <<STORE_NAME>> -o b2b -b <<BUYER_USER_EMAIL>> -u <<ORG_USERNAME>> -v <<DEVHUB_USERNAME>> --apiversion <<API_VERSION>> 

I created a blog post about it if it helps

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

No branches or pull requests

1 participant