title: InfluxDB v2 compatibility endpoint /query not working after mapping unmapped buckets
body: <p>Creating an InfluxQL datasource in Grafana to InfluxDB 2.0 (2.0.0-beta.16) failed with error:</p>
  <pre><code>can't assign to property &quot;executedQueryString&quot; on &quot;&lt;!doctype html&gt;&lt;html&gt;&lt;head&gt;&lt;meta charset=\&quot;utf-8\&quot;&gt;&lt;meta name=\&quot;viewport\&quot; content=\&quot;width=device-width,initial-scale=1\&quot;&gt;&lt;title&gt;InfluxDB 2.0&lt;/title&gt;&lt;base href=\&quot;/\&quot;&gt;&lt;link rel=\&quot;shortcut icon\&quot; href=\&quot;/favicon.ico\&quot;&gt;&lt;/head&gt;&lt;body&gt;&lt;div id=\&quot;react-root\&quot; data-basepath=\&quot;\&quot;&gt;&lt;/div&gt;&lt;script src=\&quot;/5e93c5f5aa.js\&quot;&gt;&lt;/script&gt;&lt;/body&gt;&lt;/html&gt;&quot;: not an object
  </code></pre>
  <p>I followed the procedure to map unmapped buckets on <a href="https://docs.influxdata.com/influxdb/v2.0/query-data/influxql/#map-unmapped-buckets" rel="nofollow noreferrer">https://docs.influxdata.com/influxdb/v2.0/query-data/influxql/#map-unmapped-buckets</a> and tried to create the datasource in Grafana using <a href="https://docs.influxdata.com/influxdb/v2.0/tools/grafana/#configure-grafana-to-use-influxql" rel="nofollow noreferrer">https://docs.influxdata.com/influxdb/v2.0/tools/grafana/#configure-grafana-to-use-influxql</a></p>
  <p>Using postman, I'm getting the same output when querying the InfluxDB v1 compatible endpoint:</p>
  <pre><code>curl --location --request GET 'http://54.226.129.163/query?db=db-35days&amp;rp=rp-35days' \
  --header 'Authorization: Token VuLd01YvgyBNnWQlzFXDgDT08DFGdfgr4et6456HzrNpHqKF4q8VvQUZrMLLoyUUpJbdSU0mwUPYISV1LdjQ==' \
  --data-urlencode 'q=select * from ping'
  
  &lt;!doctype html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,initial-scale=1&quot;&gt;
      &lt;title&gt;InfluxDB 2.0&lt;/title&gt;
      &lt;base href=&quot;/&quot;&gt;
      &lt;link rel=&quot;shortcut icon&quot; href=&quot;/favicon.ico&quot;&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div id=&quot;react-root&quot; data-basepath=&quot;&quot;&gt;&lt;/div&gt;
      &lt;script src=&quot;/5e93c5f5aa.js&quot;&gt;&lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  <p>I verified the database retention policy mapping is available using:</p>
  <pre><code>curl --location --request GET 'http://my-influxdb/api/v2/dbrps/06868db0219ad000?org=PBC' \
  --header 'Authorization: Token VuLd01YvgyBNnWQlzFXDgDT08DFGdfgr4et6456HzrNpHqKF4q8VvQUZrMLLoyUUpJbdSU0mwUPYISV1LdjQ=='
  
  
  {
      &quot;content&quot;: {
          &quot;id&quot;: &quot;06868db0219ad000&quot;,
          &quot;database&quot;: &quot;db-35days&quot;,
          &quot;retention_policy&quot;: &quot;rp-35days&quot;,
          &quot;default&quot;: true,
          &quot;organization_id&quot;: &quot;218adfcaf421474d&quot;,
          &quot;bucket_id&quot;: &quot;9fd165c106e5f962&quot;
      }
  }
  </code></pre>
  <p>According the documentation on <a href="https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/dbrp/" rel="nofollow noreferrer">https://docs.influxdata.com/influxdb/v2.0/reference/api/influxdb-1x/dbrp/</a>  a new database/retention-policy bucket is automatically created with a DBRP mapping, and data is written to the bucket if no matching bucket is found. I tried this as well using an &quot;all access token&quot;, but got the same wrong response:</p>
  <pre><code>curl --location --request POST 'http://my-influxdb/write?db=testdb&amp;rp=testrp' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Token VuLd01YvgyBNnWQlzFXDgDT08DFGdfgr4et6456HzrNpHqKF4q8VvQUZrMLLoyUUpJbdSU0mwUPYISV1LdjQ==' \
  --data-raw 'measurement,host=host1 field1=2i,field2=2.0 1577836800000000000'
  
  
  &lt;!doctype html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,initial-scale=1&quot;&gt;
      &lt;title&gt;InfluxDB 2.0&lt;/title&gt;
      &lt;base href=&quot;/&quot;&gt;
      &lt;link rel=&quot;shortcut icon&quot; href=&quot;/favicon.ico&quot;&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div id=&quot;react-root&quot; data-basepath=&quot;&quot;&gt;&lt;/div&gt;
      &lt;script src=&quot;/5e93c5f5aa.js&quot;&gt;&lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  <p>I can query the v2 endpoint without issues using Flux:</p>
  <pre><code>curl --location --request POST 'http://my-influxdb/api/v2/query?org=PBC' \
  --header 'Content-Type: application/vnd.flux' \
  --header 'Accept: application/csv' \
  --header 'Authorization: Token VuLd01YvgyBNnWQlzFXDgDT08DFGdfgr4et6456HzrNpHqKF4q8VvQUZrMLLoyUUpJbdSU0mwUPYISV1LdjQ==' \
  --data-raw 'from(bucket: &quot;35days&quot;)
    |&gt; range(start: -12h)
    |&gt; filter(fn: (r) =&gt; r[&quot;_measurement&quot;] == &quot;ping&quot;)
    |&gt; yield(name: &quot;mean&quot;)'
  
  
  ,result,table,_start,_stop,_time,_value,_field,_measurement,account
  ,mean,0,2020-10-27T22:52:58.644679856Z,2020-10-28T10:52:58.644679856Z,2020-10-28T08:49:35Z,0.4,standard_deviation_ms,ping,pbc
  </code></pre>