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

ext-firestore-typesense-search-indexToTypesenseOnFirestoreWrite: Request failed with HTTP code 404 | Server said: Not Found #116

Closed
rdcoder33 opened this issue Mar 13, 2022 · 17 comments
Labels
bug Something isn't working

Comments

@rdcoder33
Copy link

Hey, I have installed the extension and using the official Typesense cloud to host but I am getting this error from the firebase cloud function when creating new documents:

Flutter Web/ Dart code:

@override
void initState() {
  const host1 = "wt62ejrukzvh378pp-1.a1.typesense.net";
  const host2 = "wt62ejrukzvh378pp-2.a1.typesense.net";
  const host3 = "wt62ejrukzvh378pp-3.a1.typesense.net";
  const protocol = Protocol.http;
  final config = Configuration(
    // Replace with your configuration
    '[admin key (removed on github for security reasons)]',
    nodes: {
      Node(
        protocol,
        host1,
        port: 443,
      ),
      Node(
         protocol,
        host2,
        port: 443,
      ),
      Node(
        protocol,
        host3,
        port: 443,
      ),
    },
    numRetries: 3, // A total of 4 tries (1 original try + 3 retries)
    connectionTimeout: const Duration(seconds: 10),
  );
  client = Client(config);

  super.initState();
}

Below are the screenshots for the extension configuration and firebase functions log:

WhatsApp Image 2022-03-13 at 12 09 24
WhatsApp Image 2022-03-13 at 12 11 25

@rdcoder33 rdcoder33 added the bug Something isn't working label Mar 13, 2022
@happy-san
Copy link
Collaborator

Seems like an issue with the firebase extension.

cc: @jasonbosco @kishorenc

@happy-san
Copy link
Collaborator

happy-san commented Mar 13, 2022

@rdcoder33 Could you share the exact reproduction steps?

More specifically: The dart code you're using to write documents.

@jasonbosco
Copy link
Member

Could you make sure you've created a collection called "3d_icons" in Typesense? The Firebase extension doesn't create the collection for you - it only syncs documents within a collection.

@rdcoder33
Copy link
Author

rdcoder33 commented Mar 13, 2022

Could you make sure you've created a collection called "3d_icons" in Typesense? The Firebase extension doesn't create the collection for you - it only syncs documents within a collection.

oh didn't know that. Indexing functions work now but got a
Error: XMLHttpRequest error

when searching.

searching code in Flutter Web / Dart:

  searchTypeSense() async {
    Map<String, String> search = {
      'q': 'kid',
      'query_by': 'tags',
    };
    client.collection("3d_icons").documents.search(search);
  }

Client Config is same as above (first comment)

@jasonbosco
Copy link
Member

@rdcoder33 Could you try doing the same API call using curl and see if you're able to replicate the issue?

@rdcoder33
Copy link
Author

@rdcoder33 Could you try doing the same API call using curl and see if you're able to replicate the issue?

It works on curl:
typesense

But for the same request and parameters on dart client (pub.dev plugin) is shows following error:

dart-sdk/lib/async/stream.dart 1288:7
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 334:14 _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 339:39 dcall
dart-sdk/lib/html/dart2js/html_dart2js.dart 37301:58
at Object.createErrorWithStack (http://localhost:49794/dart_sdk.js:5080:12)
at Function._throw (http://localhost:49794/dart_sdk.js:20337:18)
at Function.throwWithStackTrace (http://localhost:49794/dart_sdk.js:20334:18)
at async._AsyncCallbackEntry.new.callback (http://localhost:49794/dart_sdk.js:40851:18)
at Object._microtaskLoop (http://localhost:49794/dart_sdk.js:40708:13)
at _startMicrotaskLoop (http://localhost:49794/dart_sdk.js:40714:13)
at http://localhost:49794/dart_sdk.js:36191:9

I am testing this on flutter web.

@jasonbosco
Copy link
Member

@happy-san Any thoughts on this ^

@rdcoder33
Copy link
Author

@happy-san
Copy link
Collaborator

happy-san commented Mar 20, 2022

Hi, @rdcoder33 this seems to be a web-specific issue. Looking around I found these links:
Hope you'll give them a try.

https://stackoverflow.com/a/66879350/11218270
https://pub.dev/packages/flutter_cors

1- Go to flutter\bin\cache and remove a file named: flutter_tools.stamp
2- Go to flutter\packages\flutter_tools\lib\src\web and open the file chrome.dart.
3- Find '--disable-extensions'
4- Add '--disable-web-security'

@happy-san
Copy link
Collaborator

Since this is a separate issue from what you opened, I'd recommend opening a new issue for future reference.

@rdcoder33
Copy link
Author

https://pub.dev/packages/flutter_cors

This doesn't solve the problem for me. Same error

@happy-san
Copy link
Collaborator

happy-san commented Mar 21, 2022

@rdcoder33 Can you share the exact response you're receiving from the server?

Specifically the response headers.

@happy-san
Copy link
Collaborator

Hi @rdcoder33
Did you resolve XMLHttpRequest error?

@rdcoder33
Copy link
Author

Ohh sorry for the late reply. Nope, it didn't get solved so we opted for the HTTP request to type sense API rather than using the flutter plugin.

@happy-san
Copy link
Collaborator

@rdcoder33 Would you care to correspond with me in figuring out a fix?

@rdcoder33
Copy link
Author

rdcoder33 commented Apr 29, 2022

@rdcoder33 Would you care to correspond with me in figuring out a fix?

I would love to but kinda a busy currently. I will send you the details of the issue by tomorrow (it's nighttime in India) and will try to correspond probably after 2-3 days.

I hope this works for you?

@happy-san
Copy link
Collaborator

Sure that'll be great. I'm in the same timezone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants