Skip to content

Cannot fetch logs from another bucket because resourceNames are being enforced #1593

@julianxhokaxhiu

Description

@julianxhokaxhiu

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

  1. Is this a client library issue or a product issue?
    This is a client library issue.

  2. Did someone already solve this?
    No, it's not even documented.

  3. Do you have a support contract?
    Support case: 62404497

If the support paths suggested above still do not result in a resolution, please provide the following details.

Environment details

  • OS: macOS 15.6.1
  • Node.js version: v22.18.0
  • npm version: 10.9.3
  • @google-cloud/logging version: 11.2.0

Steps to reproduce

  1. Create an example bucket in your GCP project and fill it with logs
  2. Get it's path and set it as a resourceNames
const { Logging } = require("@google-cloud/logging");
const logging = new Logging();

let [entries] = await logging.getEntries({
  resourceNames: ["projects/gcp-project-id-example/locations/europe-west2/buckets/example-bucket/views/_AllLogs"]
});
  1. You should be getting results. Instead you get 0 entries.

Why

Because your library is enforcing resourceNames at these lines, If I comment them out, I am able to get results.

Reason for it: those lines add an additional projects/gcp-project-id-example in the entry which somehow confuses the API.

Here an example console.log before calling the API:

console.log("getEntries ==> ", reqOpts, gaxOptions);

Result of the log:

getEntries ==>  {
  resourceNames: [
    'projects/gcp-project-id-example/locations/europe-west2/buckets/example-bucket/views/_AllLogs',
    'projects/gcp-project-id-example'
  ]
} { autoPaginate: undefined }

Metadata

Metadata

Labels

api: loggingIssues related to the googleapis/nodejs-logging API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions