diff --git a/libsql-server/src/rpc/proxy.rs b/libsql-server/src/rpc/proxy.rs index 093ad56c19..8a7f9019a6 100644 --- a/libsql-server/src/rpc/proxy.rs +++ b/libsql-server/src/rpc/proxy.rs @@ -311,6 +311,7 @@ impl ProxyService { let namespace_jwt_key = self.namespaces.with(namespace, |ns| ns.jwt_key()).await; let namespace_jwt_key = match namespace_jwt_key { Ok(Ok(jwt_key)) => Ok(jwt_key), + Err(crate::error::Error::NamespaceDoesntExist(_)) => Ok(None), Err(e) => Err(tonic::Status::internal(format!( "Error fetching jwt key for a namespace: {}", e diff --git a/libsql-server/src/rpc/replica_proxy.rs b/libsql-server/src/rpc/replica_proxy.rs index ac85058fc6..6c5aeb92a9 100644 --- a/libsql-server/src/rpc/replica_proxy.rs +++ b/libsql-server/src/rpc/replica_proxy.rs @@ -46,6 +46,11 @@ impl ReplicaProxyService { authenticated.upgrade_grpc_request(req); Ok(()) } + Err(crate::error::Error::NamespaceDoesntExist(_)) => { + let authenticated = self.auth.authenticate_grpc(req, false, None)?; + authenticated.upgrade_grpc_request(req); + Ok(()) + } Err(e) => Err(Status::internal(format!( "Error fetching jwt key for a namespace: {}", e diff --git a/libsql-server/src/rpc/replication_log.rs b/libsql-server/src/rpc/replication_log.rs index 075d9b81b4..d217c3c7fd 100644 --- a/libsql-server/src/rpc/replication_log.rs +++ b/libsql-server/src/rpc/replication_log.rs @@ -71,10 +71,18 @@ impl ReplicationLogService { } Ok(()) } - Err(e) => Err(Status::internal(format!( - "Error fetching jwt key for a namespace: {}", - e - ))), + Err(e) => match e.as_ref() { + crate::error::Error::NamespaceDoesntExist(_) => { + if let Some(auth) = &self.auth { + auth.authenticate_grpc(req, self.disable_namespaces, None)?; + } + Ok(()) + } + _ => Err(Status::internal(format!( + "Error fetching jwt key for a namespace: {}", + e + ))), + }, Ok(Err(e)) => Err(Status::internal(format!( "Error fetching jwt key for a namespace: {}", e