Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/upgrade-import-in-the-middle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"trigger.dev": patch
---

Upgrade import-in-the-middle from 1.11.0 to 3.0.0 to fix the `importAssertions` deprecation warning on Node.js v21+, v20.10.0+, and v18.19.0+.

This resolves the error: `Use importAttributes instead of importAssertions` that occurred when using certain OpenTelemetry instrumentations like `UndiciInstrumentation`, `HttpInstrumentation`, and `AwsInstrumentation`.
10 changes: 5 additions & 5 deletions packages/cli-v3/e2e/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const fixturesConfig: TestCase[] = [
externals: [
{
name: "import-in-the-middle",
version: "1.11.0",
version: "3.0.0",
},
],
files: [{ entry: "src/trigger/helloWorld.ts" }],
Expand Down Expand Up @@ -82,7 +82,7 @@ export const fixturesConfig: TestCase[] = [
},
{
name: "import-in-the-middle",
version: "1.11.0",
version: "3.0.0",
},
],
files: [{ entry: "src/trigger/ai.ts" }],
Expand Down Expand Up @@ -114,7 +114,7 @@ export const fixturesConfig: TestCase[] = [
externals: [
{
name: "import-in-the-middle",
version: "1.11.0",
version: "3.0.0",
},
],
files: [{ entry: "src/trigger/decorators.ts" }],
Expand Down Expand Up @@ -145,7 +145,7 @@ export const fixturesConfig: TestCase[] = [
externals: [
{
name: "import-in-the-middle",
version: "1.11.0",
version: "3.0.0",
},
],
files: [{ entry: "src/reactEmail.tsx" }],
Expand Down Expand Up @@ -178,7 +178,7 @@ export const fixturesConfig: TestCase[] = [
externals: [
{
name: "import-in-the-middle",
version: "1.11.0",
version: "3.0.0",
},
{
name: "mupdf",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli-v3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"gradient-string": "^2.0.2",
"has-flag": "^5.0.1",
"ignore": "^7.0.5",
"import-in-the-middle": "1.11.0",
"import-in-the-middle": "3.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Dual versions of import-in-the-middle at runtime (3.0.0 and 1.11.0)

The pnpm-lock.yaml shows that @opentelemetry/instrumentation@0.203.0 still resolves its own import-in-the-middle to 1.11.0, while the CLI's direct dependency is now 3.0.0. At runtime in customer containers, loader.ts:2-4 creates the hook message channel using v3.0.0's createAddHookMessageChannel and registers import-in-the-middle/hook.mjs from v3.0.0. Meanwhile, @opentelemetry/instrumentation uses its own v1.11.0 to call addHook for module interception. These two versions need compatible message channel protocols for the hooks to work. The v3.0.0 release was primarily about replacing importAssertions with importAttributes (as stated in the changeset), and the Hook/addHook API appears to be preserved. However, if the internal IPC protocol between hook.mjs and the Hook class changed across major versions, this could silently break OpenTelemetry instrumentation hooks. Worth verifying that the e2e tests pass end-to-end with instrumented packages (the otel-telemetry-loader fixture tests this).

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify the current loader integration still awaits the symbol instead of invoking it.
sed -n '1,120p' packages/cli-v3/src/entryPoints/loader.ts
rg -n "waitForAllMessagesAcknowledged" packages/cli-v3/src/entryPoints/loader.ts

Repository: triggerdotdev/trigger.dev

Length of output: 1009


Call waitForAllMessagesAcknowledged() as a function in the loader.

The upgrade to import-in-the-middle v3.0.0 on line 117 of package.json requires updating the loader integration. In packages/cli-v3/src/entryPoints/loader.ts line 26, waitForAllMessagesAcknowledged is currently awaited as a property reference, but the v3.0.0 API exposes it as a function. This causes the ACK barrier to be skipped, allowing execution to continue before the hook handshake completes.

Fix in packages/cli-v3/src/entryPoints/loader.ts
- await waitForAllMessagesAcknowledged;
+ await waitForAllMessagesAcknowledged();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli-v3/package.json` at line 117, The loader currently awaits the
property reference waitForAllMessagesAcknowledged instead of calling it, so
update packages/cli-v3/src/entryPoints/loader.ts to call
waitForAllMessagesAcknowledged() where it’s awaited (after importing from
import-in-the-middle) to ensure the ACK barrier runs; replace any await
waitForAllMessagesAcknowledged with await waitForAllMessagesAcknowledged() and
keep the import/usage of import-in-the-middle unchanged so the hook handshake
completes before continuing.

"import-meta-resolve": "^4.1.0",
"ini": "^5.0.0",
"json-stable-stringify": "^1.3.0",
Expand Down
44 changes: 36 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading