Giter VIP home page Giter VIP logo

Comments (4)

miyamonz avatar miyamonz commented on May 24, 2024 1

While preparing to reproduce the environment, I found what causes this.

When using npm, there is no problem, but when yarn, it happens.

If you install electrodb by npm, @aws-sdk/client-dynamodb is included by its dependency.

$ npm ls @aws-sdk/client-dynamodb
[email protected] /Users/miyamonz/ghq/github.com/miyamonz/electrodb-practice
└─┬ [email protected]
  └─┬ @aws-sdk/[email protected]
    └── @aws-sdk/[email protected]

When yarn, yarn add electrodb , then yarn list @aws-sdk/client-dynamodb , nothing exists.
That's why Error: Cannot find module '@aws-sdk/client-dynamodb' happens.

You can easily reproduce this by this:

  • install aws-sdk, electrodb with yarn
  • write some js file that has new Entity
  • run this code

I don't know well about these differences related to dependencies. I'll check this later and add a comment if I find it.


I think it's better to make this library use the AWS SDK that library users have installed themselves.
If you think so, I would like you to consider using peerDependency.

If you want to ignore that method for now and run yarn as well, you might want to add @aws-sdk/client-dynamodb in the dependencies. It's an explicit dependency in this library.

from electrodb.

miyamonz avatar miyamonz commented on May 24, 2024

Later I found this https://github.com/tywalch/electrodb/blob/master/buildbrowser.sh
you already did something about this issue.

I don't know how you deploy this as the npm library, but did something go wrong when building or deploying time?
Anyway, In the node_modules/electrodb of my project, the line exists here.
image

from electrodb.

tywalch avatar tywalch commented on May 24, 2024

I'll explore ways to bring this in conditionally. That said, you mentioned you have issues with both installed? Can you explain your issue there a bit more?

from electrodb.

kevinlonigro avatar kevinlonigro commented on May 24, 2024

I have only started exploring ElectroDB and encountered the same issue.

Resolved it by only installing the v3 SDK and passed a new instance of DynamoDBClient as a replacement for DocumentClient without issue.

"dependencies": {
"@aws-sdk/client-dynamodb": "^3.245.0",
"electrodb": "^2.3.5"
}

const { DynamoDBClient } = require('@aws-sdk/client-dynamodb');
const client = new DynamoDBClient({
region: "us-east-1"
});

...
}, { client, table });

from electrodb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.