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

Bad resource id in query from conversion_action #484

Open
neocite opened this issue Jan 26, 2024 · 1 comment
Open

Bad resource id in query from conversion_action #484

neocite opened this issue Jan 26, 2024 · 1 comment

Comments

@neocite
Copy link

neocite commented Jan 26, 2024

Hi
i try to execute this query

async getPixels(): Promise<any[]> {
const customer = this.getCustomer();

const query = `
  SELECT conversion_action.id,
         conversion_action.name,
         conversion_action.type,
         conversion_action.category,
         conversion_action.status,
         conversion_action.value_settings
  FROM conversion_action
  WHERE conversion_action.status = 'ENABLED'

`;

try {
  const response = await customer.query(query);
  return response;
} catch (error) {
  console.error('failt to get pixel information:', error);
}

}

and my get_customer method

private getCustomer() {
const client = new GoogleAdsApi({
client_id: process.env.GOOGLE_ADS_CLIENT_ID,
client_secret: process.env.GOOGLE_ADS_CLIENT_SECRET,
developer_token: process.env.GOOGLE_ADS_DEVELOPER_TOKEN,
});

return client.Customer({
  customer_id: this.customer_id,
  refresh_token: process.env.GOOGLE_ADS_REFRESH_TOKEN,
});

}

but i receive response

{"errors":[{"error_code":{"request_error":"BAD_RESOURCE_ID"},"message":"'undefined' part of the resource name is invalid."}],"request_id":"xxxx-xxxx"}

can help me?

@neocite
Copy link
Author

neocite commented Jan 26, 2024

i resolve

async getPixels(): Promise<any[]> {
const customer = this.getCustomer();

const query = `
  SELECT conversion_action.id,
         conversion_action.name,
         conversion_action.type,
         conversion_action.category,
         conversion_action.status
  FROM conversion_action
  WHERE conversion_action.status = 'ENABLED'

`;

try {
  **const options: any = {
    customer_id: this.customer_id,
  };
  const response = await customer.query(query, options);**
  return response;
} catch (error) {
  console.error('failt to get pixel information:', error);
}

}

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