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

enhance info endpoint and bump to v0.1.13 #117

Merged
merged 9 commits into from
Mar 5, 2024
15 changes: 12 additions & 3 deletions src/http-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@ import { jsonRpcRouter } from './json-rpc-api.js';
import { requestCounter, responseHistogram } from './metrics.js';
import type { RegistrationManager } from './registration/registration-manager.js';

const packageJson = process.env.npm_package_json ? JSON.parse(readFileSync(process.env.npm_package_json).toString()) : {};
const packageJson = process.env.npm_package_json ? JSON.parse(readFileSync(process.env.npm_package_json).toString()) : {
dependencies: {}
};

// when this server runs as a docker container, it is not run using the `npm` package, so `npm_package_json` env does not exist.
// we inject the versions using the respective environment variables.
const packageVersions = {
version : packageJson.version || process.env.DWN_SERVER_VERSION,
sdkVersion : packageJson.dependencies['@tbd54566975/dwn-sdk-js'] || process.env.DWN_SDK_VERSION
}

export class HttpApi {
#config: DwnServerConfig;
Expand Down Expand Up @@ -188,8 +197,8 @@ export class HttpApi {
server : process.env.npm_package_name,
maxFileSize : config.maxRecordDataSize,
registrationRequirements : registrationRequirements,
version : packageJson.version,
sdkVersion : packageJson.dependencies['@tbd54566975/dwn-sdk-js'],
version : packageVersions.version,
sdkVersion : packageVersions.sdkVersion,
webSocketSupport : config.webSocketSupport,
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/json-rpc-handlers/dwn/process-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export const handleDwnProcessMessage: JsonRpcHandler = async (
);

// log the unhandled error response
log.error('handleDwnProcessMessage error', jsonRpcResponse, e);
log.error('handleDwnProcessMessage error', jsonRpcResponse, dwnRequest, e);
return { jsonRpcResponse } as HandlerResponse;
}
};
Loading