Skip to content

[TRI-5140] The metadata.set function doesn't work when used inside a JS class #1904

Closed
@matt-aitken

Description

@matt-aitken

These calls don't actually update the metadata of the root run. The same calls work not inside a class.

import { metadata } from '@trigger.dev/sdk/v3';

export class DummyClass {
  async doSomethingAsync() {
    metadata.root.set('dummy1-async', 'foo');
    metadata.root.set('dummy2-async', 'bar');
    metadata.root.set('dummy3-async', 123);
  }

  doSomethingSync() {
    metadata.root.set('dummy4-sync', 'baz');
    metadata.root.set('dummy5-sync', 456);
  }
}

There's a reproduction repo here: https://github.com/Yoshify/trigger-repro-app/blob/main/src/trigger/example.ts

Thanks to @Yoshify for this repro

TRI-5140

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions