Plugin backend is not sending interpolated query to the go-sdk

Hello,
I have a Grafana Backend Datasource plugin. I am also using Grafana go-sdk on top of it.

I have overridden the applyTemplateVariables method in my datasource.ts file and it looks like below now:

export class Couchbase extends DataSourceWithBackend<CouchbaseQuery, CouchbaseOptions> {
  annotations = {};

  constructor(instanceSettings: DataSourceInstanceSettings<CouchbaseOptions>) {
    super(instanceSettings);
  }
  
/* eslint-disable  @typescript-eslint/no-explicit-any */
  applyTemplateVariables(query: CouchbaseQuery): Record<string, any> {
    console.log("query: ", query.rawQuery);
    query.rawQuery = getTemplateSrv().replace(query.rawQuery);
    console.log("interpolated query: ",query.rawQuery);
    return query;
  }
}

From the console in browser, I can see that the “query” is printed as undefined and “interpolated query” is being printed as an empty string:

However, on printing the logs at the go-sdk side, I can see that it is receiving the query with variables not getting interpolated:

logger=plugin.couchbase-datasource t=2023-12-18T07:22:21.841057221Z level=info msg="Querying couchbase" query_string="SELECT * FROM (select e.description, str_to_millis(e.timestamp) as timestamp from `test`.`_default`.`_default` as table unnest results.events e where meta(table).id='Timeline::$snapshotId' ) AS data where data.timestamp > STR_TO_MILLIS('2023-11-18T07:22:21Z') AND data.timestamp <= STR_TO_MILLIS('2023-12-18T07:22:21Z') ORDER by data.timestamp ASC"
logger=plugin.couchbase-datasource t=2023-12-18T07:22:21.84739318Z level=info msg="Query ok"

Can anyone help me understand why is this happening and what I have missed?
Please let me know if any further information is needed.