Skip to content

Incorrect path when using --docker-volume-basedir with local invoke/start-api #1834

Closed

Description

@dsanders11

Description

The wrong path is being used when --docker-volume-basedir is used. By the help description, the path should be to the SAM template, but for expected behavior you have to provide the path to the build artifacts.

Steps to reproduce

  1. sam build
  2. sam local invoke --docker-volume-basedir /foo

Observed result

Invoking app.lambda_handler (python3.8)

Fetching lambci/lambda:python3.8 Docker container image......
Mounting `/foo/HelloWorldFunction as /var/task:ro,delegated inside runtime container

Expected result

Invoking app.lambda_handler (python3.8)

Fetching lambci/lambda:python3.8 Docker container image......
Mounting `/foo/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated inside runtime container

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. sam --version: SAM CLI, version 0.43.0

Activity

  1. added
    area/local/start-api
    area/local/invoke
    on Mar 2, 2020
  2. nirradi commented on Apr 13, 2021

    @nirradi

    seems to be working properly in 1.12, and stops working again in 1.22

  3. xazhao commented on Jul 20, 2021

    @xazhao
    Contributor

    Currently I don't have remote Docker setup so I couldn't verify it. I need to dive deep into the code to see the root cause. But it seems related to --base-dir option in sam build. We made some changes related to that option in 1.21 so it matches to what @nirradi said. While I'm on investigation, feel free to try using --base-dir

  4. xazhao commented on Jul 23, 2021

    @xazhao
    Contributor

    Trying to reproduce this issue in the current version 1.24.1
    sam local invoke "HelloWorldFunction" -e events/event.json --docker-volume-basedir /Users/xazhao/sshfs
    And in the log it works properly
    Mounting /Users/xazhao/sshfs/.aws-sam/build/HelloWorldFunction as /var/task:ro,delegated inside runtime container
    Since it was one year ago, I believe this issue has been fixed.

    I will close the issue. If you find other bugs, feel free to create a new issue.

  5. github-actions commented on Jul 23, 2021

    @github-actions
    Contributor

    ⚠️COMMENT VISIBILITY WARNING⚠️

    Comments on closed issues are hard for our team to see.
    If you need more assistance, please either tag a team member or open a new issue that references this one.
    If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/local/invokearea/local/start-api

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions