Skip to content

fix: handle spawn ENOENT errors and prevent server crash#93

Open
Priyanshu-u07 wants to merge 3 commits intometacall:masterfrom
Priyanshu-u07:fix/faas-spawn-error
Open

fix: handle spawn ENOENT errors and prevent server crash#93
Priyanshu-u07 wants to merge 3 commits intometacall:masterfrom
Priyanshu-u07:fix/faas-spawn-error

Conversation

@Priyanshu-u07
Copy link

Summary

This PR fixes a crash in the FaaS server that happens when the metacall binary is missing from the system's PATH. It handles the ENOENT error when starting child processes and prevents the server from crashing repeatedly during startup when trying to reload failed deployments.

Related issue

Fixes #74

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Chore / CI
  • Breaking change

How to test

  1. Simulate missing dependency: Start the FaaS server in an environment where metacall is missing.
    • Windows (PowerShell):
      $env:PATH = "C:\Windows\system32;C:\Program Files\nodejs;C:\Windows\System32\WindowsPowerShell\v1.0\"; npm start
    • Linux: PATH="/usr/bin:/bin" npm start
  2. Trigger the bug: In a separate terminal, attempt to deploy any application:
    metacall-deploy --dev
  3. Verify survival: Observe that the server logs a warning (spawn metacall ENOENT) but remains online.
  4. Verify recovery: Restart the server. Observe that it successfully boots by skipping the broken app in the cache instead of crashing.

Checklist

  • I have read the contributing guidelines
  • I added tests that prove my fix is effective or that my feature works
  • I updated documentation if necessary

Notes for reviewers

  • Fix Strategy: We added a proc.on('error') listener in deploy.ts to handle spawn failures gracefully without crashing.
  • Data Safety: In autoDeploy.ts, the implementation now logs and skips failures instead of deleting the cached app folder. This prevents startup crash loops while keeping user data safe during temporary environment issues.

Release notes

Fixed a fatal server crash and startup loop occurring when the MetaCall binary is missing from the environment PATH.

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.

MetaCall FaaS Fails to Start After Deployment Attempt (ENOENT: spawn metacall Error)

1 participant