- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.7k
 
Description
What version of Remix are you using?
1.18.1
Are all your remix dependencies & dev-dependencies using the same version?
- Yes
 
Steps to Reproduce
When you are using dev_v2 mode in an Architect app, when you interrupt npm run dev with ^C, it kills all subprocesses with extreme prejudice and does not permit Architect plugins to clean up.
To reproduce:
- Start a basic Architect project using create-remix.
 - Add a toy sandbox plugin that has a 
startmethod (which would normally start a sidecar process --- such as an OpenSearch server) and astopmethod (which would normally stop the sidecar process and delete any temporary directories). For example: 
plugin-sandbox.js
export default {
  sandbox: {
    start() {
      console.log("starting example sandbox plugin");
    },
    end() {
      console.log("stopping example sandbox plugin");
    },
  },
};- Install this plugin in app.arc.
 
app.arc
...
@plugins
plugin-remix
  src plugin-remix.js
plugin-example
  src plugin-example.js
...
- Fire up the dev server using 
npm run dev. Wait until it's up and running. - Stop the dev server with a keyboard interrupt (^C on Linux and macOS).
 
Expected Behavior
The dev server should come down cleanly and you should see both of the log messages from the Architect sandbox plugin, both starting example sandbox plugin and stopping example sandbox plugin. Here's the good output with dev_v2: false set. For a reproducer, see https://github.com/lpsinger/remix-bug-report-arc-sandbox-killed-ungracefully/tree/dev_v1.
$ npm run dev
> dev
> npm-run-all build --parallel "dev:*"
> build
> remix build
 info  building... (NODE_ENV=production)
 info  built (315ms)
> dev:remix
> remix watch
> dev:arc
> cross-env NODE_ENV=development arc sandbox
Watching Remix app in development mode...
💿 Building...
         App ⌁ remix-architect-app
      Region ⌁ us-west-2
     Profile ⌁ @aws profile / AWS_PROFILE not configured
     Version ⌁ Architect 10.13.1
         cwd ⌁ /private/tmp/my-remix-app
✓ Sandbox @http (HTTP API mode / Lambda proxy v2.0 format / live reload) routes
    any /* ................................ server
    http://localhost:3333
✓ Sandbox Started in 9ms
❤︎ Local environment ready!
⚬ Sandbox Running 1 Sandbox startup plugin
starting example sandbox plugin
✓ Sandbox Ran Sandbox startup plugin in 7ms
✓ Sandbox File watcher now looking for project changes
💿 Rebuilt in 441ms
[REMIX DEV] D7AD53A4 ready
^C
⚬ Sandbox Running 1 Sandbox shutdown plugin
stopping example sandbox plugin
✓ Sandbox Ran Sandbox shutdown plugin in 0ms
^C
Actual Behavior
Here's the bad output. You see starting example sandbox plugin, but you never see stopping example sandbox plugin. For a reproducer, see https://github.com/lpsinger/remix-bug-report-arc-sandbox-killed-ungracefully/tree/dev_v2.
$ npm run dev
> dev
> remix dev --no-restart -c "arc sandbox -e testing"
 💿  remix dev
 info  building...
 info  built (536ms)
         App ⌁ remix-architect-app
      Region ⌁ us-west-2
     Profile ⌁ @aws profile / AWS_PROFILE not configured
     Version ⌁ Architect 10.13.1
         cwd ⌁ /private/tmp/my-remix-app
✓ Sandbox @http (HTTP API mode / Lambda proxy v2.0 format / live reload) routes
    any /* ................................ server
    http://localhost:3333
✓ Sandbox Started in 9ms
❤︎ Local environment ready!
⚬ Sandbox Running 1 Sandbox startup plugin
starting example sandbox plugin
✓ Sandbox Ran Sandbox startup plugin in 4ms
✓ Sandbox File watcher now looking for project changes
^C