Opteo / google-ads-api

Google Ads API client library for Node.js
https://opteo.com
MIT License
270 stars 90 forks source link

Updated package after previous error about API v9. Now getting an error about a previously working function. #441

Closed sgpascoe closed 1 year ago

sgpascoe commented 1 year ago

I'm getting a new error in a function since updating the package. Can I no longer use GAQL?

The error:


Error: 12 UNIMPLEMENTED: Operation is not implemented, or supported, or enabled.
    at Object.callErrorFromStatus (.\@grpc\grpc-js\build\src\call.js:31:19)
    at Object.onReceiveStatus (.\@grpc\grpc-js\build\src\client.js:190:52)
    at Object.onReceiveStatus (.\@grpc\grpc-js\build\src\client-interceptors.js:365:141)
    at Object.onReceiveStatus (.\@grpc\grpc-js\build\src\client-interceptors.js:328:181)
    at .\@grpc\grpc-js\build\src\call-stream.js:188:78
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
for call at
    at ServiceClientImpl.makeUnaryRequest (.\@grpc\grpc-js\build\src\client.js:160:30)
    at ServiceClientImpl.<anonymous> (.\@grpc\grpc-js\build\src\make-client.js:105:19)
    at .\google-ads-node\build\src\v9\google_ads_service_client.js:335:29
    at wrappedCall (.\google-gax\build\src\paginationCalls\pagedApiCaller.js:86:20)
    at .\google-gax\build\src\normalCalls\timeout.js:44:16
    at repeat (.\google-gax\build\src\normalCalls\retries.js:80:25)
    at .\google-gax\build\src\normalCalls\retries.js:118:13
    at PagedApiCaller.call (.\google-gax\build\src\paginationCalls\pagedApiCaller.js:126:25)
    at .\google-gax\build\src\createApiCall.js:81:30 {
  code: 12,
  details: 'Operation is not implemented, or supported, or enabled.',
  metadata: Metadata { internalRepr: Map(0) {}, options: {} },
  note: 'Exception occurred in retry method that was not classified as transient'

The function:

async function getsearchtermdata(selectedclient) {
customer = await definecustomer(selectedclient);
  console.log('Search term gathering for selected client', customer.customerOptions.customer_id)

  try {

    var search_terms = customer.query
    (`SELECT search_term_view.search_term  
    FROM search_term_view 
    WHERE search_term_view.status = 'NONE' 
    and segments.date DURING LAST_30_DAYS `);

    console.log('Success - Finished gathering search terms from Google')

  } catch(err) {
    console.log('ads/define customer - uh oh', err)
    if (err instanceof errors.GoogleAdsFailure) {
      console.log(err.errors); // Array of errors.GoogleAdsError instances
      // Get the first one and explicitly check for a certain error type
      const [firstError] = err.errors;
      if (
        firstError.error_code ===
        errors.QueryErrorEnum.QueryError.UNRECOGNIZED_FIELD
      ) {
        console.log(
          `Error: using invalid field "${firstError.trigger}" in query`
        );
      }
    }
  } 
  finally {
     console.log('Finished:', await search_terms)

    return await search_terms
  }
}
sgpascoe commented 1 year ago

Updating all packages now gives me #439