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

query-node: hotfix membership metadata handler #4838

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions query-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.3.0

- Fix external resources mapping of membership metadata to ignore unrecognized type.

### 1.2.2

- Integrates OpenTelemetry API/SDK with Query Node's Graphql Server for exporting improved tracing logs & metrics to Elasticsearch. Adds `./start-elasticsearch-stack.sh` script to bootstrap elasticsearch services (Elasticsearch + Kibana + APM Server) with all the required configurations.
Expand Down
2 changes: 1 addition & 1 deletion query-node/mappings/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "query-node-mappings",
"version": "1.2.1",
"version": "1.3.0",
"description": "Mappings for hydra-processor",
"main": "lib/src/index.js",
"license": "MIT",
Expand Down
14 changes: 8 additions & 6 deletions query-node/mappings/src/membership.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import {
getMemberById,
getWorker,
getWorkingGroupByName,
invalidMetadata,
logger,
saveMetaprotocolTransactionErrored,
saveMetaprotocolTransactionSuccessful,
Expand Down Expand Up @@ -126,13 +127,14 @@ function asMembershipExternalResource(
): Pick<MembershipExternalResource, 'type' | 'value'>[] {
const typeKey = isSet(resource.type) && MembershipMetadata.ExternalResource.ResourceType[resource.type]

if (!typeKey || !(typeKey in MembershipExternalResourceType)) {
throw new Error(`Invalid ResourceType: ${typeKey}`)
if (typeKey && typeKey in MembershipExternalResourceType) {
const type = MembershipExternalResourceType[typeKey]
const value = resource.value
return type && value ? [{ type, value }] : []
} else {
invalidMetadata(`Invalid ResourceType: ${resource.type}`)
return []
}

const type = MembershipExternalResourceType[typeKey]
const value = resource.value
return type && value ? [{ type, value }] : []
}

async function saveMembershipMetadata(
Expand Down
2 changes: 1 addition & 1 deletion query-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "query-node-root",
"version": "1.2.2",
"version": "1.3.0",
"description": "GraphQL server and mappings. Generated with ♥ by Hydra-CLI",
"scripts": {
"build": "./build.sh",
Expand Down
Loading