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.

dynamodbDocClient error

See original GitHub issue

Describe the bug

A clear and concise description of what the bug is. When i use the V3 DynamoDBClient code getting error

import { dbResult, DynamoCodeSystem } from './types'
import { DynamoDBClient, GetItemCommand, PutItemCommand } from '@aws-sdk/client-dynamodb'
import { marshall, unmarshall } from '@aws-sdk/util-dynamodb'
import { TsRequest, CsMetaLoad } from 'src/interfaces/tsRequest'
import { getDynamoConfig, getDynamoDbTableName } from '@libs/dynamoDb/config'

export const getCodeSystem = async (cs:string) : Promise<DynamoCodeSystem|null> => {
  const dbclient = new DynamoDBClient(getDynamoConfig());
  const { Item } = await dbclient.send(new GetItemCommand({
    TableName: getDynamoDbTableName(),
    Key: marshall({
      key1: 'CodeSystem',
      key2: cs,
    }),
    ProjectionExpression: 'deleted, meta'
  }));

  if (Item===undefined) 
    return null;

  const item = unmarshall(Item);

  if (item.deleted===1)
    return null;

  return item.meta;
};

2021-08-02T23:05:01.169Z be4582ab-8839-4ca5-8fd1-723ba28054b4 INFO New DBDOC Clinet Aug 01 Error CredentialsProviderError: Could not load credentials from any providers at providers (/var/task/node_modules/@aws-sdk/client-dynamodb/node_modules/@aws-sdk/credential-provider-node/src/index.ts:66:13) at /var/task/node_modules/@aws-sdk/client-dynamodb/node_modules/@aws-sdk/property-provider/src/chain.ts:20:18 at processTicksAndRejections (internal/process/task_queues.js:95:5) at SignatureV4.credentialProvider (/var/task/node_modules/@aws-sdk/client-dynamodb/node_modules/@aws-sdk/property-provider/src/memoize.ts:72:22) at SignatureV4.signRequest (/var/task/node_modules/@aws-sdk/client-dynamodb/node_modules/@aws-sdk/signature-v4/src/SignatureV4.ts:220:25) at /var/task/node_modules/@aws-sdk/client-dynamodb/node_modules/@aws-sdk/middleware-signing/src/middleware.ts:28:18 at StandardRetryStrategy.retry (/var/task/node_modules/@aws-sdk/client-dynamodb/node_modules/@aws-sdk/middleware-retry/src/StandardRetryStrategy.ts:83:38) at /var/task/node_modules/@aws-sdk/client-dynamodb/node_modules/@aws-sdk/middleware-logger/src/loggerMiddleware.ts:22:22 at data (/var/task/node_modules/@aws-sdk/lib-dynamodb/src/commands/GetCommand.ts:48:20) at /var/task/src/functions/csLoadReq/webpack:/ts-load/src/libs/dynamoDb/codeSystem.ts:61:11 { tryNextLink: false, ‘$metadata’: { attempts: 1, totalRetryDelay: 0 } }

Your environment

SDK version number

@aws-sdk/package-name@version

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

Browser/Node.js/ReactNative

Details of the browser/Node.js/ReactNative version

Paste output of npx envinfo --browsers or node -v or react-native -v

Steps to reproduce

Please share code or minimal repo, and steps to reproduce the behavior.

Observed behavior

A clear and concise description of what happens.

Expected behavior

A clear and concise description of what you were expecting to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AllanZhengYPcommented, Sep 20, 2021

@hectorgabucio Good to know it’s fixed!

0reactions
github-actions[bot]commented, Oct 5, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling with DynamoDB - AWS Documentation
Discover the best practices for handling client and server errors and exceptions returned by Amazon DynamoDB operations.
Read more >
Common DynamoDB Errors (and Solutions) - Dynobase
DynamoDB not working as expected? This page is a compilation of the most common DynamoDB user/system errors and how to fix them.
Read more >
AWS DynamoDB DocumentClient not throwing expected error
I'm using DynamoDB to store data and trying to read items using JavaScript. I have a function that will read an item from...
Read more >
DynamoDB.DocumentClient does not throw any error and fails ...
The AWS.DynamoDB.DocumentClient accepts JSON objects, but not instantiated objects. The root of this behavior is in how the client converts ...
Read more >
Functions - Calling DynamoDB from Lambda in Node.js
js environment is to use the DynamoDB document client. In this guide you will learn how to interact with a DynamoDB database from...
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