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

The requested resource does not exist when run sf data query #2861

Open
gtiancai opened this issue May 9, 2024 · 12 comments
Open

The requested resource does not exist when run sf data query #2861

gtiancai opened this issue May 9, 2024 · 12 comments
Labels
more information required Issue requires more information or a response from the customer

Comments

@gtiancai
Copy link

gtiancai commented May 9, 2024

Summary

When we use command sf data query --query $theQuery --bulk --target-org $theOrg --wait 5 --json to query data in pipeline (Azure DevOps), we get error like this:
{'code': 1, 'context': 'DataSoqlQueryCommand', 'commandName': 'DataSoqlQueryCommand', 'message': 'The requested resource does not exist', 'name': 'NOT_FOUND', 'status': 1, 'stack': 'NOT_FOUND: The requested resource does not exist\n at SfError.create (/usr/local/lib/node_modules/@salesforce/cli/node_modules/@salesforce/core/lib/sfError.js:81:23)\n at SfError.wrap (/usr/local/lib/node_modules/@salesforce/cli/node_modules/@salesforce/core/lib/sfError.js:104:25)\n at DataSoqlQueryCommand.runBulkSoqlQuery (file:///usr/local/lib/node_modules/@salesforce/cli/node_modules/@salesforce/plugin-data/lib/commands/data/query.js:143:77)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async DataSoqlQueryCommand.run (file:///usr/local/lib/node_modules/@salesforce/cli/node_modules/@salesforce/plugin-data/lib/commands/data/query.js:97:19)\n at async DataSoqlQueryCommand._run (/usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/command.js:311:22)\n at async Config.runCommand (/usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:433:25)\n at async run (/usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/main.js:92:16)', 'exitCode': 1, 'warnings': []}
But it works correct if run the script in local. Any ideas on this error?

Steps To Reproduce

Run query like above within Python script from pipeline.

Expected result

No error

Actual result

Throw above error

@gtiancai gtiancai added the investigating We're actively investigating this issue label May 9, 2024
Copy link

github-actions bot commented May 9, 2024

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.

Copy link

github-actions bot commented May 9, 2024

Hello @gtiancai 👋 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 May 9, 2024
@gtiancai
Copy link
Author

gtiancai commented May 9, 2024

Output of doctor command:
2024-05-09T08:53:54.309Z config init hook done
2024-05-09T08:53:54.310Z config runCommand SELECT:Id,:Class__c,:Message__c,:Level__c,:Reference__c,:CreatedDate,:CreatedBy.Name:FROM:MyTable__cc:WHERE:CreatedDate [ '=', 'Yesterday', 'AND', 'Level__c', '=', 'MOBILE ERROR' ]
2024-05-09T08:53:54.310Z config start command_not_found hook
2024-05-09T08:53:54.311Z config:ts-path Skipping typescript path lookup for /usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/plugin-not-found because NODE_ENV is NOT "test" or "development"
2024-05-09T08:53:54.439Z sf:@oclif/plugin-not-found:hooks:command_not_found start (import) /usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/plugin-not-found/lib/index.js
› Warning: �[33mSELECT Id, Class__c, Message__c, Level__c, Reference__c, �[39m
› �[33mCreatedDate, CreatedBy.Name FROM �[39m
› �[33mMyTable__c WHERE CreatedDate�[39m is not a sf command.
2024-05-09T08:54:04.669Z sf:@oclif/plugin-not-found:hooks:command_not_found Error: Run �[1m�[36msf help�[39m�[22m for a list of available commands.
at error (/usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/errors/error.js:37:15)
at Object.error (/usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:479:40)
at Object.hook (file:///usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/plugin-not-found/lib/index.js:37:10)
at async /usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:507:27
at async Promise.all (index 4)
at async Config.runHook (/usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:535:9)
at async Config.runCommand (/usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/config/config.js:398:19)
at async run (/usr/local/lib/node_modules/@salesforce/cli/node_modules/@oclif/core/lib/main.js:92:16)

@gtiancai
Copy link
Author

Anybody can help on this?

@mdonnalley
Copy link
Contributor

@gtiancai can you provide the version info? sf version --verbose as well as the full debug output of the failing command (using --dev-debug)?

@gtiancai
Copy link
Author

gtiancai commented May 17, 2024

The version is 2.40.7.

Looks like the cause is that the query returns too many records (17K), but it does not throw this error with version 2.6.9.

And I even tried to run the query in async, and then use command sf data query resume to retrieve result, got same error with this command.

@gtiancai
Copy link
Author

Also, it will not throw error if add a limit clause to the query (I set it as LIMIT 50000, greater than 17K, weird.)

@iowillhoit
Copy link
Contributor

I am confused what the actual error is here.

  • In your first comment, I see The requested resource does not exist. Which indicates the query was incorrect.
  • In your second comment, I see the following which indicates that the $theQuery var was not wrapped in quotes:
› Warning: �[33mSELECT Id, Class__c, Message__c, Level__c, Reference__c, �[39m
› �[33mCreatedDate, CreatedBy.Name FROM �[39m
› �[33mMyTable__c WHERE CreatedDate�[39m is not a sf command.
  • The too many records makes me think that the --bulk flag was forgotten?
  • I don't know why setting the LIMIT 50000 makes this work

I need all of the following to help any further:

  • The full output of sf version --verbose --json. This will be multiple lines
  • The actual query being used as the $theQuery
  • The output that the CLI provides when you add the --dev-debug flag to the command that is failing

@gtiancai
Copy link
Author

gtiancai commented May 20, 2024

I did add the flag --bulk. What I sad adding limit to the query, is just adding LIMIT 50000 to the query, no other change.

This pipeline is hosted by customer, so that I cannot provide sf version --verbose --json and --dev-debug. It just logged the CLI version: 2.40.7.

@iowillhoit
Copy link
Contributor

A few more thoughts from the team:

  • Requested resource doesn't exist can also mean they don't have permission to see the thing they queried for
  • It might also mean that they queried for a tooling object without using the --use-tooling-api flag, or the other way around
  • You mentioned this works locally but not in Azure, maybe it is a cross-OS issue? Linux vs Windows?

Without the actual query and some additional logs, I am afraid we won't be able to help on this.

@gtiancai
Copy link
Author

gtiancai commented May 27, 2024

As I said before, it works if adding a LIMIT clause. It's not related to anything from your previous post.
Where I can find the command sf data query related code?

@iowillhoit
Copy link
Contributor

The data query code lives in https://github.com/salesforcecli/plugin-data

See: https://github.com/salesforcecli/plugin-data/blob/main/src/commands/data/query.ts

FYI: You can find which command lives in which plugin by running the sf which command. For example sf which data query will output plugin: @salesforce/plugin-data. Most of our plugins live in the https://github.com/salesforcecli/ org. But you can also find them by looking at the "repository" or "homepage" for the plugin on npm. https://www.npmjs.com/package/@salesforce/plugin-data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more information required Issue requires more information or a response from the customer
Projects
None yet
Development

No branches or pull requests

3 participants