aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
3.11k stars 578 forks source link

Cant find variable Credential #3573

Closed bimix closed 2 years ago

bimix commented 2 years ago

Describe the bug

I am using the Timestream SDK for React-Native but I am facing an issue when configuring the client.

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

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

Your environment

React Native

SDK version number

"@aws-sdk/client-timestream-query": "^3.79.0",

Is the issue in the browser/Node.js/ReactNative?

ReactNative

Details of the browser/Node.js/ReactNative version

"react-native": "0.68.0"

Steps to reproduce

Install SDK in a bare RN project, and have the configuration code set as I do above. Run RN app.

Observed behavior

Expected behavior

No error.

ajredniwja commented 2 years ago

Hey @bimix thanks for opening this issue, can you please share complete reproducible code? For above piece of code I can run it just fine using my own credentials.

bimix commented 2 years ago

new Credentials

how do you import 'Credentials' ?

RanVaknin commented 2 years ago

Hi @bimix!

You can setup the client the following way:

const client = new TimestreamQueryClient({
   region: "us-east-1",
   accessKeyId: "XXXXXXXXXXXX",
   secretAccessKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
   apiVersion: 'latest'
});

To answer your second question about how to import Credentials please see the following:

First of all you need to make sure you have a credentials set up for your AWS account to interact with the SDK.

Let me know if this answers your questions or if you need anything else. Cheers

github-actions[bot] commented 2 years ago

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.