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

Allow passing translateConfig to Dynamo client and doc client #542

Open
bzang opened this issue Feb 3, 2023 · 8 comments
Open

Allow passing translateConfig to Dynamo client and doc client #542

bzang opened this issue Feb 3, 2023 · 8 comments

Comments

@bzang
Copy link

bzang commented Feb 3, 2023

Is your feature request related to a problem? Please describe.
In certain situations I need to use the Dynamodb option to removeUndefinedValues . Currently it doesn't seem like we can pass these options in the arc.tables().

Describe the solution you'd like
I'd like to be able to pass config parameters to the tables() call in order to pass these option to where the Client and DocClient are being instantiated. Maybe something like

const options = {
  docConfig: {
    marshallOptions: {
      convertEmptyValues: false,
      removeUndefinedValues: true,
      convertClassInstanceToMap: true,
    },
    unmarshallOptions: {
      wrapNumbers: true,
    }
  };

Describe alternatives you've considered
If it set up my own Dynamo client instance instead of using the arc provided tables() call, users would still have problems because we'd lose the advantages of the main arc functions package.

@hungds99
Copy link

I have the same issues. I want to custom endpoint and region for arc.tables().

@ryanblock
Copy link
Member

ryanblock commented Jan 12, 2024

@bzang @hungds99 a big update is about to land in Arc Functions: 8.0 drops the AWS SDK (and stock DynamoDB client) in favor of aws-lite. More details:

For whatever it's worth, under the hood aws-lite uses the AWS-flavored JSON marshall/unmarshall utilities. Can you present a use case scenario we can look at within the aws-lite implementation? Specifically: some code / data that isn't currently working that should work?

@hungds99
Copy link

hi @ryanblock , I am try to using aws-lite for my Shopify App Remix project but I got this issue : Property 'DynamoDB' does not exist on type 'AwsLiteClient'.

import AwsLite from '@aws-lite/client';

const awsLiteClient = async () => {
  const aws = await AwsLite({ region: 'us-west-1' });

  // Easily interact with the AWS services your application relies on
  await aws.DynamoDB.PutItem({
    TableName: '$table-name',
    Item: {
      // AWS-lite automatically de/serializes DynamoDB JSON
      pk: '$item-key',
      data: {
        ok: true,
        hi: 'friends',
      },
    },
  });
};

@ryanblock
Copy link
Member

Did you install @aws-lite/dynamodb?

@hungds99
Copy link

@ryanblock Yes, my dependencies:

 "@aws-lite/client": "^0.14.0",
 "@aws-lite/dynamodb": "^0.3.1",
 "@aws-lite/dynamodb-types": "^0.3.1",

@ryanblock
Copy link
Member

I wonder if that's because Remix is bundling things – I'd suggest getting started without bundling so you can isolate issues as you pick up the new SDK. From there you may need to specify a path to the DynamoDB plugin with the plugins configuration (see: https://aws-lite.org/configuration#general-config).

@ryanblock
Copy link
Member

Actually, I may have also misread your issue above. So the DynamoDB call works ok, it's the types that are broken? If so, can you open an issue in the aws-lite project with steps to reproduce (including code editor, version, etc.)?

@hungds99
Copy link

@ryanblock Sure, I have another question. Currently, I am using arc for deployment to AWS but I see the table name have specific ID like this BAppAdminRemixProduction-ShopSessionsTable-359Z4PXN3ZOU. Can I use aws-lite dynamodb interact with table in arc deploy ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants