Somehow the most basic dynamoose example throws following error:
Cannot read property 'includes' of undefined
Code:
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');
})();
Any ideas? The error happens in the moveParameterNames
function in the DocumentRetriever.js
file. But I don't really know what causes the error in the first place.
Solution
As pointed out in the comments. Removing index: true
resolves the issue.