Hello,
I'm trying to use the Javascript SDK (version 3) to run the ListTableRowsCommand. Everything seems to be working fine in terms of passing in credentials and parameters, but I keep getting a CORS issue due to the x-amz-content-sha256 request header.
The error says:
Access to fetch at https://honeycode.us-west-2.amazonaws.com/workbooks/WORKBOOK_ID_XXX/tables/TABLE_ID_XXX/rows/list from origin localhost:3000 has been blocked by CORS policy: Request header field x-amz-content-sha256 is not allowed by Access-Control-Allow-Headers in preflight response.
I understand the CORS error, however I don't know where I'm supposed to update the Server response headers to allow x-amz-content-sha256.
Any thoughts?
Thank you,
Christian
import { HoneycodeClient, ListTableRowsCommand } from "@aws-sdk/client-honeycode";
function App() {
const [loading, setLoading] = useState(true);
const [rows, setRows] = useState([]);
const client = new HoneycodeClient({
region: process.env.REACT_APP_HONEYCODE_REGION,
credentials: {
accessKeyId: process.env.REACT_APP_AWS_ACCESS_KEY_ID,
accessSecretKey: process.env.REACT_APP_AWS_SECRET_ACCESS_KEY
}
})
const params = {
tableId: process.env.REACT_APP_HONEYCODE_TABLE_ID,
workbookId: process.env.REACT_APP_HONEYCODE_WORKBOOK_ID
}
const command = new ListTableRowsCommand(params);
useEffect(async () => {
try {
const data = await client.send(command);
setRows(data);
} catch (error) {
console.error(error);
}
}, [client, command])