Skip to content

Why does Patch Need to include GSI attributes in its operation? #266

Answered by tywalch
barqco asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @barqco 👋

This is because the schema provided is invalid:

  1. The index name needs to be at the root of the access pattern
  2. The index names and fields are duplicated for userByEmail and userByInstagramUsername

The typing wierdness you're seeing is due to typescript being unable to infer the primary index composite because of #1 (it can't tell which which index is the primary index)

Electro will throw at startup in these cases 👍

Here is a working schema:

export const UserEntity = new Entity(
  {
    model: {
      version: "1",
      entity: "User",
      service: "barqco",
    },
    attributes: {
      user_id: { type: "string", required: true },
      email: { type: "string", required: f…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@barqco
Comment options

Answer selected by tywalch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants