Skip to content

TypeScript quickstart chat module throws error when inserting chat message #3497

@cloutiertyler

Description

@cloutiertyler

This is from the quickstart chat module:

spacetimedb.reducer('send_message', { text: t.string() }, (ctx, { text }) => {
  // Things to consider:
  // - Rate-limit messages per-user.
  // - Reject messages from unnamed user.
  validateMessage(text);
  console.info(`User ${ctx.sender}: ${text}`);
  ctx.db.message.insert({
    sender: ctx.sender,
    text,
    sent: ctx.timestamp,
  });
});

There are to issues:

  1. The insert line throws an error: SyntaxError: Cannot convert [object Object] to a BigInt
  2. That error is not printed as a panic by the host in the module logs (the developer has no way to know it's happened)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions