Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working Directory is ignored in the Docker Image #121

Open
wperron opened this issue Dec 21, 2020 · 3 comments
Open

Working Directory is ignored in the Docker Image #121

wperron opened this issue Dec 21, 2020 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@wperron
Copy link
Contributor

wperron commented Dec 21, 2020

I have the following configuration in Terraform:

resource "aws_lambda_function" "this" {
  # ...
  image_config {
    working_directory = "/var/task/foo/bar"
    command           = ["baz.handler"]
  }
}

but the bootstrap script seems to be ignoring the working_directory parameter and tries to import /var/task/baz.js instead of /var/task/foo/bar/baz.js - as a workaround I commented out the parameter and changed the command to ["foo/bar/baz.handler"]

@hayd
Copy link
Contributor

hayd commented Dec 22, 2020

Atm CMD ["foo/bar/baz.handler"] is the way forward. In some sense that's not a workaround but has always been the way to reference files not at the top level.

It's unclear to me how to support working directory... i need to think about it a little more... what you are supposed to do with LAMBDA_TASK_ROOT vs WORKDIR? 🤔

@wperron
Copy link
Contributor Author

wperron commented Dec 22, 2020

We should run some tests with some of the default runtimes to see how they behave, that might enlighten us as to how to support workdir for the deno runtime.

@hayd
Copy link
Contributor

hayd commented Dec 22, 2020

Not looked into this but my suspicion is what should be done is cd into /var/task and realpath the WORKDIR (initial directory).

# realpath -m --relative-to="/var/task/" "/var/task/foo/bar/baz.handler"
foo/bar/baz.handler

and use this as the HANDLER (if WORKDIR=LAMBDA_TASK_ROOT then above is a noop).

However, for sure there will need to be DENO_DIR tweak (since it's relative atm, but shouldn't be really).

@hayd hayd added the help wanted Extra attention is needed label Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants