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

Collections with ids that contain spaces cause errors in the emulated environment. #48

Open
bmcbarron opened this issue Mar 27, 2023 · 1 comment

Comments

@bmcbarron
Copy link

Description

One of my top level collections that has this extension configured contains a space in its name: "zip codes". Although this appears to work fine in a production environment, it throws errors in the emulated dev environment. From firebase-debug.log and the thrown exception, it appears that the space leads to parsing errors. Here's the relevant excerpt of the logs during emulator initialization.

[debug] [2023-03-27T21:44:49.727Z] addFirestoreTrigger "{\"eventTrigger\":{\"eventType\":\"providers/cloud.firestore/eventTypes/document.write\",\"resource\":\"projects/millies-catering/databases/(default)/documents/zip codes/{documentID}\",\"service\":\"firestore.googleapis.com\"}}"

Any write to this collection throws an error:

[debug] [2023-03-27T22:00:37.772Z] Mar 27, 2023 6:00:37 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError
INFO: operation failed: Invalid pattern. Reason: [59: codes/{documentID}] Unrecognized character(s) at end of path.
java.lang.IllegalArgumentException: Invalid pattern. Reason: [59: codes/{documentID}] Unrecognized character(s) at end of path.
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:151)
	at com.google.firebase.rules.eventflow.client.path.PathPattern.compileInternal(PathPattern.java:79)
	at com.google.firebase.rules.eventflow.client.path.PathPattern.compile(PathPattern.java:51)
	at com.google.firebase.rules.eventflow.client.EventRuleEvaluatorImpl.lambda$new$0(EventRuleEvaluatorImpl.java:56)
	at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:446)
	at com.google.firebase.rules.eventflow.client.EventRuleEvaluatorImpl.<init>(EventRuleEvaluatorImpl.java:50)
	at com.google.firebase.rules.eventflow.client.EventRuleEvaluatorImpl.<init>(EventRuleEvaluatorImpl.java:37)
	at com.google.cloud.datastore.emulator.impl.events.EventManager.reportEvents(EventManager.java:84)
	at com.google.cloud.datastore.emulator.impl.CloudFirestoreV1.commitHelper(CloudFirestoreV1.java:1014)
	at com.google.cloud.datastore.emulator.impl.CloudFirestoreV1.internalCommit(CloudFirestoreV1.java:902)
	at com.google.cloud.datastore.emulator.impl.CloudFirestoreV1.commit(CloudFirestoreV1.java:450)
	at com.google.cloud.datastore.emulator.impl.CloudFirestoreV1Router.commit(CloudFirestoreV1Router.java:152)
	at com.google.cloud.datastore.emulator.firestore.v1.FirestoreV1GrpcAdapter$1.lambda$commit$8(FirestoreV1GrpcAdapter.java:160)
	at com.google.cloud.datastore.emulator.firestore.v1.FirestoreV1GrpcAdapter.unary(FirestoreV1GrpcAdapter.java:70)
	at com.google.cloud.datastore.emulator.firestore.v1.FirestoreV1GrpcAdapter$1.commit(FirestoreV1GrpcAdapter.java:160)
	at com.google.firestore.v1.FirestoreGrpc$MethodHandlers.invoke(FirestoreGrpc.java:1286)
	at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
	at io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
	at io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
	at io.grpc.ForwardingServerCallListener$SimpleForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:40)
	at io.grpc.Contexts$ContextualizedServerCallListener.onHalfClose(Contexts.java:86)
	at io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
	at io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
	at io.grpc.ForwardingServerCallListener$SimpleForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:40)
	at io.grpc.Contexts$ContextualizedServerCallListener.onHalfClose(Contexts.java:86)
	at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:355)
	at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:867)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1589)

Steps to reproduce

Create a collection whose name contains a space. (e.g. zip codes)

Expected Behavior

All valid collection names should be allowed, as per:
https://firebase.google.com/docs/firestore/quotas#limits

Actual Behavior

Spaces result in unexpected segmentation within some parser, preventing their uses.

Metadata

Typesense version: 0.24.0
Extension version: typesense/[email protected]
OS: Windows 11

@jasonbosco
Copy link
Member

I don't see any lines in the stack trace related to the extension code... Wonder if it's an issue with the emulator.

@i14h Any thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants