Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matt-aitken opened this issue Apr 9, 2025 · 0 comments · Fixed by #1917
Closed

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

matt-aitken opened this issue Apr 9, 2025 · 0 comments · Fixed by #1917
Milestone

Comments

@matt-aitken
Copy link
Member

matt-aitken commented Apr 9, 2025

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

@matt-aitken matt-aitken changed the title The metadata.set function doesn't work when used inside a JS class [TRI-5140] The metadata.set function doesn't work when used inside a JS class Apr 9, 2025
@matt-aitken matt-aitken added this to the v.94 milestone Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant