How to configure AWS Timestream SDK in React Native? (Error: Cant find variable Credential)

407 Views Asked by At

I need to configure the RN SDK for AWS timestream but I keep getting an error:

Cant find variable Credential.

import { TimestreamQueryClient, CreateDatabaseCommand } from "@aws-sdk/client-timestream-query";

const client = new TimestreamQueryClient({
   region: "eu-west-1",
   credentials: new Credential('XXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'), // fails here
   apiVersion: 'latest'
});

What am I doing wrong here?!

I was not able to find any documentation regarding the SDK configuration in RN.

1

There are 1 best solutions below

3
On

I see that you are using the AWS SDK for JavaScript v3. To successfully use this API, you need to setup you DEV environment - including your creds. All these details are discussed in the AWS JavaScript V3 DEV Guide. I recommend that you read topics in this guide - which includes setting up your creds.

Setting up the SDK for JavaScript

As you want to work in React - this topic is very important for you to read - it has all the required instructions:

Getting started in React Native

This Guide is also referenced from the doc you pointed me too:

enter image description here