Title: Issue on docs · Issue #2828 · triggerdotdev/trigger.dev · GitHub
Open Graph Title: Issue on docs · Issue #2828 · triggerdotdev/trigger.dev
X Title: Issue on docs · Issue #2828 · triggerdotdev/trigger.dev
Description: Path: /run-usage In export const heavyTask = task({ id: "heavy-task", machine: { preset: "medium-2x", }, run: async (payload, { ctx }) => { // Do some compute const result = await convertVideo(payload.videoUrl); // Get the current cost a...
Open Graph Description: Path: /run-usage In export const heavyTask = task({ id: "heavy-task", machine: { preset: "medium-2x", }, run: async (payload, { ctx }) => { // Do some compute const result = await convertVideo(payl...
X Description: Path: /run-usage In export const heavyTask = task({ id: "heavy-task", machine: { preset: "medium-2x", }, run: async (payload, { ctx }) => { // Do some compute const result = ...
Opengraph URL: https://github.com/triggerdotdev/trigger.dev/issues/2828
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Issue on docs","articleBody":"Path: /run-usage\n\nIn\n\n```ts\nexport const heavyTask = task({\n id: \"heavy-task\",\n machine: {\n preset: \"medium-2x\",\n },\n run: async (payload, { ctx }) =\u003e {\n // Do some compute\n const result = await convertVideo(payload.videoUrl);\n\n // Get the current cost and duration up until this line of code\n // This includes the compute time of the previous lines\n let currentUsage = usage.getCurrent(); // ❓ ← Where is `usage` coming from?\n /* currentUsage = {\n compute: {\n attempt: {\n costInCents: 0.01700,\n durationMs: 1000,\n },\n total: {\n costInCents: 0.0255,\n durationMs: 1500,\n },\n },\n baseCostInCents: 0.0025,\n totalCostInCents: 0.028,\n } \n */\n\n // In the cloud product we do not count waits towards the compute cost or duration.\n // We also don't include time between attempts or before the run starts executing your code.\n // So this line does not affect the cost or duration.\n await wait.for({ seconds: 5 });\n\n // This will give the same result as before the wait.\n currentUsage = usage.getCurrent();\n\n // Do more compute\n const result = await convertVideo(payload.videoUrl);\n\n // This would give a different value\n currentUsage = usage.getCurrent();\n },\n});\n```\n\nThe keyword \"usage\" has no declaration (`let currentUsage = usage.getCurrent();` ). I assume it is either part of the `ctx` or part of the second argument like `({ ctx, usage })`.","author":{"url":"https://github.com/rickvdbroek","@type":"Person","name":"rickvdbroek"},"datePublished":"2026-01-04T21:41:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/2828/trigger.dev/issues/2828"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d42cc22a-e162-b3e5-d952-3892b6e9b3dd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8E58:25AC7:19CA4B5:2354D37:6964BB84 |
| html-safe-nonce | af92d2dbce1c14c924a48da3e58afb1ae56e3f93124bc23decf9315a3e3c65fa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTU4OjI1QUM3OjE5Q0E0QjU6MjM1NEQzNzo2OTY0QkI4NCIsInZpc2l0b3JfaWQiOiI0OTQ2MzgwNDYwNjU2OTk5MzAwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e9f95fcbf751314879876eb225993c8084abe01e873d4466980ebe996904d1e8 |
| hovercard-subject-tag | issue:3779673918 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/triggerdotdev/trigger.dev/2828/issue_layout |
| twitter:image | https://opengraph.githubassets.com/373571a20462592a71131700d214bcf786569657363774c84a9801188ab67fc2/triggerdotdev/trigger.dev/issues/2828 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/373571a20462592a71131700d214bcf786569657363774c84a9801188ab67fc2/triggerdotdev/trigger.dev/issues/2828 |
| og:image:alt | Path: /run-usage In export const heavyTask = task({ id: "heavy-task", machine: { preset: "medium-2x", }, run: async (payload, { ctx }) => { // Do some compute const result = await convertVideo(payl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rickvdbroek |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9917306ebdf5f9f30d13ede7b74f08a45b5f12b401ce3e4bfabd895ea0ca0ada |
| turbo-cache-control | no-preview |
| go-import | github.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git |
| octolytics-dimension-user_id | 95297378 |
| octolytics-dimension-user_login | triggerdotdev |
| octolytics-dimension-repository_id | 572570113 |
| octolytics-dimension-repository_nwo | triggerdotdev/trigger.dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 572570113 |
| octolytics-dimension-repository_network_root_nwo | triggerdotdev/trigger.dev |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 020ceddb26807bba62dcfb410905847d63243ff5 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width