mirror of
https://github.com/xtr-dev/rondevu-server.git
synced 2025-12-15 13:23:23 +00:00
Fix service discovery bug: Use parsed.serviceName instead of parsed.service
Bug: getService() was accessing parsed.service (undefined) instead of
parsed.serviceName, causing D1_TYPE_ERROR in service discovery.
This affected both random discovery (line 263) and paginated discovery
(line 218) when clients requested services without specifying username.
The parseServiceFqn() function returns { serviceName, version, username },
not { service, version, username }.
Fixes: D1_TYPE_ERROR: Type 'undefined' not supported for value 'undefined'
when discovering services like 'test-chat:1.0.0' (without @username)
This commit is contained in:
@@ -215,7 +215,7 @@ const handlers: Record<string, RpcHandler> = {
|
||||
const pageLimit = Math.min(Math.max(1, limit), MAX_PAGE_SIZE);
|
||||
const pageOffset = Math.max(0, offset || 0);
|
||||
|
||||
const allServices = await storage.discoverServices(parsed.service, parsed.version, 1000, 0);
|
||||
const allServices = await storage.discoverServices(parsed.serviceName, parsed.version, 1000, 0);
|
||||
const compatibleServices = filterCompatibleServices(allServices);
|
||||
|
||||
// Get unique services per username with available offers
|
||||
@@ -260,7 +260,7 @@ const handlers: Record<string, RpcHandler> = {
|
||||
}
|
||||
|
||||
// Mode 3: Random discovery without username
|
||||
const randomService = await storage.getRandomService(parsed.service, parsed.version);
|
||||
const randomService = await storage.getRandomService(parsed.serviceName, parsed.version);
|
||||
|
||||
if (!randomService) {
|
||||
throw new Error('No services found');
|
||||
|
||||
Reference in New Issue
Block a user