Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Don't attemot to re-run the import if there is an import failure
Browse files Browse the repository at this point in the history
Run with --no-check  by default (perhaps should be a config)
  • Loading branch information
hayd committed Dec 8, 2020
1 parent 79e2a7a commit 79b1b52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions runtime/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ if [[ -z "$DENO_DIR" ]]; then
fi

# Potentially this could be overwritten HOWEVER several permissions are required for bootstrap.
# FIXME should this simply be -A?
# FIXME can plugins work?? (If so, it should be documented.)
DENO_FLAGS="-A"
# Note: Do can plugins work?? (If so, it should be documented.)
DENO_FLAGS="-A --no-check"
DENO_CACHE_FLAGS=""

# For unstable flags we must pass --unstable
Expand Down Expand Up @@ -95,11 +94,7 @@ function investigate {
DENO_DIR=/tmp/deno_dir NO_COLOR=true deno cache $DENO_CACHE_FLAGS $LAMBDA_TASK_ROOT/$HANDLER_FILE &> /dev/null \
|| error "unable to compile $HANDLER_FILE"

echo "import { $HANDLER_NAME } from '$LAMBDA_TASK_ROOT/$HANDLER_FILE';" > /tmp/runtime-test.js
DENO_DIR=/tmp/deno_dir NO_COLOR=true deno run $DENO_IMPORTMAP /tmp/runtime-test.js &> /dev/null \
|| error "unable to import '$HANDLER_NAME' from $HANDLER_FILE";

# FIXME perhaps a bug in bootstrap? Should we always exit 1? Or not?
# e.g. the HANDLER_FILE threw an error or did not import HANDLER_NAME
error "deno exited"
}

Expand Down Expand Up @@ -229,7 +224,6 @@ mkdir -p /tmp/deno_dir/gen/file$LAMBDA_TASK_ROOT
# We cp first from the deno-lambda-layer.
cp -R /opt/.deno_dir/gen/. /tmp/deno_dir/gen &> /dev/null \
&& cp -R /opt/.deno_dir/deps/. /tmp/deno_dir/deps &> /dev/null \
&& cp -R /opt/.deno_dir/LAMBDA_TASK_ROOT/. /tmp/deno_dir/gen/file$LAMBDA_TASK_ROOT &> /dev/null \
|| true
# Then we overwrite with from the DENO_DIR in the function code.
cp -R $LAMBDA_TASK_ROOT/$DENO_DIR/gen/. /tmp/deno_dir/gen &> /dev/null \
Expand Down
2 changes: 1 addition & 1 deletion tests/test_missing_handler.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"expected": [
{
"status": "error",
"content": "{\"errorMessage\" : \"unable to import 'missing' from handlers.ts\", \"errorType\" : \"InitException\"}"
"content": "{\"errorMessage\" : \"deno exited\", \"errorType\" : \"InitException\"}"
}
],
"files": ["handlers.ts"],
Expand Down

0 comments on commit 79b1b52

Please sign in to comment.