question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"endpoint" configuration parameter is ignored by DynamoDBClient

See original GitHub issue

Describe the bug

Trying to migrate to aws-sdk 3 from aws-sdk 2. We are using endpoint configuration parameter to have the Dynamo client talk to a local instance of Dynamo for unit tests, but the SDK ignores it, and keeps trying to reach the remote Dynamo, resulting in an error ExpiredToken: The security token included in the request is expired

Your environment

Node 12.20.1, MacOS Catalina

SDK version number

@aws-sdk/client-dynamodb”: “3.16.0”

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

Node.js

Details of the browser/Node.js/ReactNative version

Node 12.20.1

Steps to reproduce

const {DynamoDBClient, BatchWriteItemCommand} = require('@aws-sdk/client-dynamodb');
const {marshall} = require('@aws-sdk/util-dynamodb');

(async () => {
  const dynamoClient = new DynamoDBClient({endpoint: "http://localhost:2348"});
  const ids = ['1232'];
  const params = {
    RequestItems: {
      'mytable': ids.map((id) => {
        return {
          DeleteRequest: {
            Key: marshall({id}),
          },
        };
      }),
    },
  };
const command = new BatchWriteItemCommand(params);
await dynamoClient.send(command);
})().catch(e => {
  console.log(e, 'error');
})

Observed behavior

AWS SDK client tries to send requests to real Dynamo AWS.

Expected behavior

AWS SDK client should be sending requests to local Dynamo instance.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:14
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gornostalcommented, Jan 24, 2022

@frannav ah, I remember – it was an issue related to nestjs dependency injection. I’ve misconfigured it and it would create an SNSClient instance without passing the config object in there.

0reactions
trivikrcommented, Nov 11, 2022

Revisiting during review meeting. The action item would be to check if endpoint which contains localhost is overridden in any middleware.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration for the AWS SDK for PHP Version 3
If a service does not support endpoint discovery this configuration is ignored. Aws\EndpointDiscovery\ConfigurationInterface. An optional configuration ...
Read more >
DynamoDbDataStoreBuilder (launchdarkly-java-server-sdk ...
The AWS SDK provides many configuration options for a DynamoDB client. ... Parameters: endpointUri - the custom endpoint URI; Returns: the builder ...
Read more >
Amazon DynamoDB Client :: Quarkiverse Documentation
If you're going to use a local DynamoDB instance, configure it as follows: quarkus.dynamodb.endpoint-override=http://localhost:4566 ...
Read more >
Amazon DynamoDB Sink Connector Configuration Properties
DynamoDB Parameters¶. aws.dynamodb.max.retry.time.seconds. The maximum time up to which the DynamoDB client will try writing records.
Read more >
How to run DynamoDB Local and Offline - Complete Guide
If you want to connect to this container using SDK or CLI, don't forget to change the endpoint parameter in the configuration.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found