stac-utils / stac-server

A Node-based STAC API, AWS Serverless, OpenSearch
MIT License
68 stars 27 forks source link

When prehook is configured, it throws an exception when the api parsing the response from prehook lambda #771

Open williamsia opened 3 months ago

williamsia commented 3 months ago

There was an release last year that bump the version of aws sdk from version 2 to 3. But in version 3 the lambda response payload is now unit8array (look at the discussion here) , so we need to convert the response before doing JSON.parse()

.e.g.

import { toUtf8 } from '@aws-sdk/util-utf8-node';

const rawHookResult = JSON.parse(toUtf8(invocationResponse.Payload))
philvarner commented 3 months ago

Thanks for the report! Feel free to create a PR that fixes this.