forcedotcom / forcedotcom/commerce-on-lightning
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.
- Dominant language
- TypeScript
- Stars
- 84
- Forks
- 84
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
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 \"admin@b2b.commerce.pf\" -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 <> -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 <> -o b2b -b <> -u <> -v <> --apiversion <>
```
I created a [blog post](https://medium.com/@julianvirguez/create-a-fully-functional-sf-b2b-commerce-site-in-less-than-7-minutes-725f50ea56df) about it if it helps
Contributor guide
Research direction
Start in src/lib/utils/sfdx/forceDataSoql.ts, especially line 56, and trace how commerce:store:create supplies the target org to the generated data command. Reproduce the command with the shown store:create arguments, then verify the record creation uses the selected org without hardcoding a scratch-org nickname and no longer produces the reported failure or deprecated-flag warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100