Comments (4)
Thanks for the excellent issue description. I can reproduce this and will get back to you with diagnosis soon.
from dynamodb-onetable.
Okay, diagnosed this issue.
The core issue is the handling of value templates was not taking into account dependent fields. i.e. the UUID needed to be generated before preparing the PK field. The fix is to calculate the order of dependencies in the properties and to calculate the property values according to that order.
There was an associated issue with create
when a PK/SK is not fully provided in the API properties.
We'll add a samples directory with a sample modeled on your bug code for verification.
See latest commit for the fix and for the samples/crud
Fixed in 1.4.2
from dynamodb-onetable.
FYI: DynamoDB won't let you write empty strings.
So
gs1sk: { type: String, value: '' },
Should always have a non-empty value.
Also, if you prefer, once defining the UUID in the table, each field can use
uuid: true
to use the Table level setting, which you set to 'ulid'.
Last tip, define a logger to see the actual generated DynamoDB code.
Add this to your Table params:
logger: (type, message, context) => {
if (type == 'trace' || type == 'data') return
console.log(type, message, JSON.stringify(context, null, 4))
}
from dynamodb-onetable.
@mobsense Thanks for the quick fix! I just tested it and it works now =)
I've applied your tips as well, however now I'm facing a new problem: I can't create a Table from my app. I used to create the table via CLI before, but I'd like to do it all programatically.
I've opened a new issue (#43) for this so I'm closing this one.
from dynamodb-onetable.
Related Issues (20)
- BatchWrite does not handle Unprocessed Items correctly and ignores them HOT 1
- "?boolean" in Table.d.ts triggers typescript build error HOT 2
- model.upsert({ ...data }) returns a data with encrypted values HOT 2
- Need release to resolve Typescript ESM Resolution issues HOT 2
- params.fields are not respected when using table.getItem() or table.queryItems()
- Metrics.d.ts should not include function interfaces declared as 'async' HOT 7
- Improve: Prohibit the removal of nested object required fields. HOT 1
- Feature: Across entities query HOT 3
- Empty strings are filtered out HOT 2
- Cannot resolve type when ESM HOT 3
- Compound global index not updated if only 1 of 2 properties passed to the update function HOT 1
- Updating unique template field does not remove unique record HOT 2
- "CredentialsProviderError: The SSO session associated with this profile has expired" in "overview" sample... HOT 2
- Create method does not create the sort key if one attribute is undefined HOT 4
- Connecting OneTable to a local dynamodb instance
- Support for Mapped Types HOT 3
- Please Help: Update Problem (referenced attribute) HOT 3
- OneSchema type for getCurrentSchema() not set HOT 2
- Update operation does not remove object from array HOT 1
- Help: retrieving items by GSI1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dynamodb-onetable.