Skip to content

Fix packaging by adding amoro transform at startup for the backend worker#115

Merged
mcollina merged 1 commit intomainfrom
fix-packaging
Oct 27, 2025
Merged

Fix packaging by adding amoro transform at startup for the backend worker#115
mcollina merged 1 commit intomainfrom
fix-packaging

Conversation

@mcollina
Copy link
Copy Markdown
Member

No description provided.

…rker

Signed-off-by: Matteo Collina <hello@matteocollina.com>
@mcollina
Copy link
Copy Markdown
Member Author

This fixes the packaging but there is still a problem when exiting.

This is the output I'm getting:

npx watt-admin --record --profile cpu
Name: composer-next-node-fastify
PID: 71058
Working directory: /Users/matteo/repos/leads-demo
Command: /Users/matteo/.nvm/versions/node/v22.21.0/bin/node /Users/matteo/repos/leads-demo/node_modules/.bin/wattpm start
Starting Watt admin...
--------
[21:35:18.409] INFO (71095): Starting the worker 0 of the application "backend"...
[21:35:18.411] INFO (71095): Starting the worker 0 of the application "composer"...
[21:35:18.411] INFO (71095): Starting the worker 0 of the application "frontend"...
[21:35:18.412] INFO (composer:0/71095): Waiting for dependencies to start.
    dependencies: [
      "backend",
      "frontend"
    ]
[21:35:18.469] INFO (71095): Started the worker 0 of the application "frontend"...
[21:35:18.517] INFO (backend:0/71095): Server listening at http://127.0.0.1:62084
[21:35:18.519] INFO (71095): Started the worker 0 of the application "backend"...
[21:35:18.595] INFO (composer:0/71095): start watching applications
    applications: [
      {
        "id": "backend",
        "openapi": {
          "url": "/documentation/json",
          "prefix": "/api"
        },
        "proxy": {
          "ws": {},
          "prefix": "/api"
        },
        "origin": "http://backend.plt.local"
      }
    ]
[21:35:18.611] INFO (71095): Started the worker 0 of the application "composer"...
[21:35:18.611] INFO (71095): Platformatic is now listening at http://127.0.0.1:4042
[21:35:18.608] WARN (composer:0/71095): @fastify/reply-from might not behave as expected when used with @fastify/multipart
[21:35:18.609] WARN (composer:0/71095): @fastify/reply-from might not behave as expected when used with @fastify/multipart
[21:35:18.609] WARN (composer:0/71095): @fastify/reply-from might not behave as expected when used with @fastify/multipart
[21:35:18.611] INFO (composer:0/71095): Server listening at http://127.0.0.1:4042
[21:35:18.614] INFO (composer:0/71095): incoming request
    reqId: "86a38e2e-fbe4-49a3-8dce-bbe986e08aa6"
    req: {
      "method": "POST",
      "url": "/api/record/71058",
      "host": "127.0.0.1:4042",
      "remoteAddress": "127.0.0.1",
      "remotePort": 62086
    }
[21:35:18.615] INFO (composer:0/71095): fetching from remote server
    reqId: "86a38e2e-fbe4-49a3-8dce-bbe986e08aa6"
    source: "http://backend.plt.local/record/71058"
[21:35:18.617] INFO (backend:0/71095): incoming request
    reqId: "695a573c-e624-436c-81a8-c3e598dd726c"
    req: {
      "method": "POST",
      "url": "/record/71058",
      "host": "127.0.0.1:4042",
      "remoteAddress": "127.0.0.1",
      "remotePort": 62085
    }
[21:35:19.051] INFO (backend:0/71095): request completed
    reqId: "695a573c-e624-436c-81a8-c3e598dd726c"
    res: {
      "statusCode": 200
    }
    responseTime: 434.47612500190735
[21:35:19.052] INFO (composer:0/71095): response received
    reqId: "86a38e2e-fbe4-49a3-8dce-bbe986e08aa6"
[21:35:19.054] INFO (composer:0/71095): request completed
    reqId: "86a38e2e-fbe4-49a3-8dce-bbe986e08aa6"
    res: {
      "statusCode": 200
    }
    responseTime: 439.11270904541016
^C[21:35:20.392] INFO (71095): Stopping the worker 0 of the application "composer"...
[21:35:20.392] INFO (composer:0/71095): incoming request
    reqId: "59a2d6fa-1071-47d2-8900-8d23e5c71858"
    req: {
      "method": "POST",
      "url": "/api/record/71058",
      "host": "127.0.0.1:4042",
      "remoteAddress": "127.0.0.1",
      "remotePort": 62086
    }
second SIGINT, exiting

@rozzilla have you got any ideas?

@rozzilla
Copy link
Copy Markdown
Contributor

@rozzilla have you got any ideas?

@mcollina it seems that the transpilation do not work properly on the frontend.
I see this error:
[15:43:21.698] ERROR (frontend/62277) <STDERR>: 3:43:21 PM [vite] (client) Pre-transform error: Failed to load url /src/main.tsx (resolved id: /src/main.tsx). Does the file exist?

And when I open the watt-admin interface at http://127.0.0.1:5042/, I see this
Screenshot 2025-10-24 at 15 44 42

@rozzilla
Copy link
Copy Markdown
Contributor

By the way, with npm run dev or leveraging the npm run clean && npm run build && npm run start commands, the app works fine. So this seems an issue related to how the ./cli.js starts the @platformatic/runtime with the new create method (upgraded from the v3). Previously (with v2), we didn't have this issue.

@mcollina
Copy link
Copy Markdown
Member Author

This can land. There is a problem in npx sending SIGINT twice, which would need to be specially handled here.

This is required to fix it: platformatic/platformatic#4380.

This PR can land.

@mcollina mcollina merged commit 6f23ddf into main Oct 27, 2025
1 check passed
@mcollina mcollina deleted the fix-packaging branch October 27, 2025 13:56
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 this pull request may close these issues.

2 participants