0

不知何故,最基本的dynamoose示例引发以下错误:

Cannot read property 'includes' of undefined

代码:

import * as dynamoose from 'dynamoose';
import { Document } from 'dynamoose/dist/Document';

type User = {
  id: string;
  createdAt: number;
  updatedAt: number;
};

interface UserDocument extends Document, User {}

const UserSchema = new dynamoose.Schema(
  {
    id: {
      type: String,
      required: true,
      index: true,
    },
  },
  { timestamps: true },
);

const UserModel = dynamoose.model<UserDocument>('Strung-Users', UserSchema, {
  create: false,
  waitForActive: false,
});

(async () => {
  console.log('START');
  const user = await UserModel.query('id').eq('userId').exec();

  console.log('END');
})();

有任何想法吗?错误发生在文件中的moveParameterNames函数中DocumentRetriever.js。但我真的不知道是什么导致了错误。

解决方案

正如评论中指出的那样。删除index: true可以解决问题。

4

0 回答 0