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

http://localhost:8086/api/v2/query?org={org} method not allowed #147

Open
shaktee opened this issue Sep 6, 2024 · 1 comment
Open

http://localhost:8086/api/v2/query?org={org} method not allowed #147

shaktee opened this issue Sep 6, 2024 · 1 comment
Labels
question Further information is requested

Comments

@shaktee
Copy link

shaktee commented Sep 6, 2024

Describe the bug

I am using the queryService.query() to make a query and it is returning a 400 (Bad Request) with the following

{
"code": "method not allowed",
"message": "allow: OPTIONS, POST"
}

To Reproduce
Steps to reproduce the behavior:

  1. Run an influxdb database InfluxDB v2.7.10 (git: f302d9730c) build_date: 2024-08-16T20:19:28Z
  2. Perform a query
 var client = InfluxDBClient(
        url: 'http://localhost:8086',
        token: '<token>',
        org: 'ORG',
        bucket: 'BUCKET',
        client: RemoveUserAgentClient(),
        debug: true);

var queryService = client.getQueryService();
var records = await queryService.queryRaw(''' ... ''');

Expected behavior
Expect a string of records in records

Specifications:

  • Client Version: influxdb_client: ^2.10.0
  • InfluxDB Version: InfluxDB v2.7.10 (git: f302d9730c) build_date: 2024-08-16T20:19:28Z
  • Platform: GCP instance Linux 6.1.0-23-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.99-1 (2024-07-15) x86_64 GNU/Linux

Additional context
I had to strip the user agent info because chrome was erroring out with unsafe header errors if I did not do that. the code for that is

class RemoveUserAgentClient extends http.BaseClient {
  final http.Client _inner = http.Client();

  RemoveUserAgentClient();

  @override
  Future<http.StreamedResponse> send(http.BaseRequest request) {
    request.headers
        .removeWhere((key, value) => key.toLowerCase() == 'user-agent');
    return _inner.send(request);
  }
}
@bednar
Copy link
Contributor

bednar commented Sep 9, 2024

Hi @shaktee,

Thank you for engaging with our client. Just to clarify, are you currently using the client within a web environment?

Is this something you would be willing to help with? All PR is welcome and we will be happy to review your submission.

Best Regards.

@bednar bednar added the question Further information is requested label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants