claudiajs / claudia

Deploy Node.js projects to AWS Lambda and API Gateway easily

Home Page:https://claudiajs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

claudia failures close process

mklaber opened this issue · comments

It's entirely possible I'm being daft or have some how messed up my own node.js (v9.11.1 via nvm) installation but I've been unable to replicate the following behaviour with anything except Claudia.

tl;dr: claudia errors terminate my macOS Terminal session

  • Expected behaviour:

When running a claudia command that (legitimately) fails on macOS, I expect an error to be printed to the terminal and claudia to exit leaving the terminal ready for another command.

  • What actually happens:

When running a claudia command that (legitimately) fails, my macOS Terminal session is terminated.

  • Link to a minimal, executable project that demonstrates the problem:

No need to create a project, just follow these steps:

npm i claudia -g
claudia create --name hello-world --region eu-west-1 --handler main.handler --config some-config.json

Output:

package.json does not exist in the source folder
Saving session...completed.

[Process completed]

image

I tried replicating the error handling from cmd.js in a separate file:

console.error('some error');
process.exit(1);

And node some-test-file.js

And it did not close the Terminal.

what terminal program are you using? exiting a process with code 1 should be perfectly legitimate to stop with an error, and this works OK on my MacOs terminal.

macOS's Terminal.

I am no longer able to reproduce this consistently so will close this issue.

For reference, I figured it out. I've got a script that I was running to set my local environment variables before running claudia. The script (set-env.sh) looks like:

#!/usr/bin/env bash

set -e

export $(egrep -v '^#' .env | xargs)

I then executed it by doing . set-env.sh

The problematic line is the set -e which was causing the Terminal to exit.

@gojko is there/can there be support for dotenv for the CLI tool?