[go: nahoru, domu]

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

bug: DynamoDB not returning tables when credentials are provided by fromNodeProviderChain #10063

Closed
1 task done
LucasAmos opened this issue Jan 12, 2024 · 2 comments
Closed
1 task done
Labels
aws:dynamodb Amazon DynamoDB status: backlog Triaged but not yet being worked on status: resolved/stale Closed due to staleness type: bug Bug report

Comments

@LucasAmos
Copy link
LucasAmos commented Jan 12, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When creating a DynamoDBDocumentClient with credentials provided by the @aws-sdk/credential-providers fromNodeProviderChain function and calling the ListTablesCommand function an empty array is returned
If the credentials are hardcoded then the tables are returned e.g.

    credentials: {
      accessKeyId: "accessKeyId",
      secretAccessKey: "secretAccessKey"
    }

Expected Behavior

TableNames should be returned when credentials created using fromNodeProviderChain function are passed in to the DynamoDBDocumentClient

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker-compose.yml
---
version: "2.1"

services:
  localstack:
    image: localstack/localstack:3.0.2
    container_name: localstack
    ports:
      - "4566-4599:4566-4599" # ports of the different services
      - "9000:9000"
    environment:
      - SERVICES=sqs,dynamodb,lambda,apigateway,s3,iam,sts
      - DEFAULT_REGION=eu-west-1
      - PORT_WEB_UI=9000
      - DATA_DIR=/tmp/localstack/data
      - DOCKER_HOST=unix:///var/run/docker.sock
      - START_WEB=1
      - DEBUG=1
    volumes:
      - ./aws:/docker-entrypoint-initaws.d
      - /var/run/docker.sock:/var/run/docker.sock

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

aws --endpoint-url=http://localhost.localstack.cloud:4566 dynamodb create-table --cli-input-json file://table.json

table.json

{
  "TableName": "entryIndex",
  "KeySchema": [
    {
      "KeyType": "HASH",
      "AttributeName": "pk"
    },
    {
      "KeyType": "RANGE",
      "AttributeName": "sk"
    }
  ],
  "AttributeDefinitions": [
    {
      "AttributeName": "sk",
      "AttributeType": "S"
    },
    {
      "AttributeName": "pk",
      "AttributeType": "S"
    }
  ],
  "BillingMode": "PAY_PER_REQUEST",
  "GlobalSecondaryIndexes": [
    {
      "IndexName": "getByEntryID",
      "Projection": {
        "ProjectionType": "KEYS_ONLY"
      },
      "KeySchema": [
        {
          "AttributeName": "sk",
          "KeyType": "HASH"
        }
      ]
    }
  ]
}
import { DeleteCommand, DynamoDBDocumentClient, PutCommand } from "@aws-sdk/lib-dynamodb";
import { DynamoDBClient, ListTablesCommand} from "@aws-sdk/client-dynamodb";
import { fromNodeProviderChain } from "@aws-sdk/credential-providers";


  const credentials = fromNodeProviderChain();
  const {secretAccessKey, accessKeyId} = await credentials();
  const client =  DynamoDBDocumentClient.from(
   new DynamoDBClient({
    endpoint: process.env.AWS_ENDPOINT_URL,
    region: "eu-west-1",
    credentials: {
      accessKeyId: accessKeyId,
      secretAccessKey: secretAccessKey
    }
  }));

  const TableNames = await client.send(new ListTablesCommand({}));
  console.log(TableNames);

Environment

- OS: Ventura 13.4.1
- LocalStack: 3.0.2

Anything else?

No response

@LucasAmos LucasAmos added status: triage needed Requires evaluation by maintainers type: bug Bug report labels Jan 12, 2024
@localstack-bot
Copy link
Collaborator

Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.

@ackdav ackdav added aws:dynamodb Amazon DynamoDB status: backlog Triaged but not yet being worked on and removed status: triage needed Requires evaluation by maintainers labels Jan 15, 2024
@localstack-bot
Copy link
Collaborator

Hello 👋! It looks like this issue hasn’t been active in longer than five months. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@localstack-bot localstack-bot added the status: stale To be closed soon due to staleness label Jun 13, 2024
@localstack-bot localstack-bot added status: resolved/stale Closed due to staleness and removed status: stale To be closed soon due to staleness labels Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:dynamodb Amazon DynamoDB status: backlog Triaged but not yet being worked on status: resolved/stale Closed due to staleness type: bug Bug report
Projects
None yet
Development

No branches or pull requests

3 participants