-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
area/buildsam build commandsam build commandstage/waiting-for-releaseFix has been merged to develop and is waiting for a releaseFix has been merged to develop and is waiting for a release
Description
Description:
specified package is not in build folder when package is specified as relative-path in requirements.txt.
this cause import error.
Steps to reproduce:
STEP1: Use this Files
|-- api_shared_pkg
| |-- api_shared
| | `-- utils.py
| `-- setup.py
|-- hello_world
| |-- __init__.py
| |-- app.py
| `-- requirements.txt
`-- template.yaml
template.yaml
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: hello_world/
Handler: app.lambda_handler
Runtime: python3.8
hello_world/requirements.txt
./api_shared_pkg
code -> https://github.com/ksilverwall/aws-sam-cli-test
STEP2: Build
sam build --debug
Observed result:
2021-07-16 18:54:35,349 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2021-07-16 18:54:35,350 | Using config file: samconfig.toml, config environment: default
2021-07-16 18:54:35,350 | Expand command line arguments to:
2021-07-16 18:54:35,350 | --template_file=/Users/kazuki_tsunemi/work/newbiz/products/work/sample-app/template.yaml --build_dir=.aws-sam/build --cache_dir=.aws-sam/cache
2021-07-16 18:54:35,426 | 'build' command is called
2021-07-16 18:54:35,428 | No Parameters detected in the template
2021-07-16 18:54:35,457 | 1 stacks found in the template
2021-07-16 18:54:35,457 | No Parameters detected in the template
2021-07-16 18:54:35,497 | 1 resources found in the stack
2021-07-16 18:54:35,497 | No Parameters detected in the template
2021-07-16 18:54:35,518 | Found Serverless function with name='HelloWorldFunction' and CodeUri='hello_world/'
2021-07-16 18:54:35,518 | --base-dir is not presented, adjusting uri hello_world/ relative to /Users/kazuki_tsunemi/work/newbiz/products/work/sample-app/template.yaml
2021-07-16 18:54:35,518 | No Parameters detected in the template
2021-07-16 18:54:35,540 | Instantiating build definitions
2021-07-16 18:54:35,540 | No previous build graph found, generating new one
2021-07-16 18:54:35,540 | Unique function build definition found, adding as new (Function Build Definition: BuildDefinition(python3.8, /Users/kazuki_tsunemi/work/newbiz/products/work/sample-app/hello_world, Zip, , 5f9b7c1f-3928-4ba8-834e-0e4ad0a9b36c, {}, {}, []), Function: Function(name='HelloWorldFunction', functionname='HelloWorldFunction', runtime='python3.8', memory=None, timeout=None, handler='app.lambda_handler', imageuri=None, packagetype='Zip', imageconfig=None, codeuri='/Users/kazuki_tsunemi/work/newbiz/products/work/sample-app/hello_world', environment=None, rolearn=None, layers=[], events=None, metadata=None, inlinecode=None, codesign_config_arn=None, stack_path=''))
2021-07-16 18:54:35,542 | Building codeuri: /Users/kazuki_tsunemi/work/newbiz/products/work/sample-app/hello_world runtime: python3.8 metadata: {} functions: ['HelloWorldFunction']
2021-07-16 18:54:35,542 | Building to following folder /Users/kazuki_tsunemi/work/newbiz/products/work/sample-app/.aws-sam/build/HelloWorldFunction
2021-07-16 18:54:35,543 | Loading workflow module 'aws_lambda_builders.workflows'
2021-07-16 18:54:35,548 | Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip', application_framework=None)'
2021-07-16 18:54:35,550 | Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm', application_framework=None)'
2021-07-16 18:54:35,552 | Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler', application_framework=None)'
2021-07-16 18:54:35,553 | Registering workflow 'GoDepBuilder' with capability 'Capability(language='go', dependency_manager='dep', application_framework=None)'
2021-07-16 18:54:35,554 | Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules', application_framework=None)'
2021-07-16 18:54:35,556 | Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle', application_framework=None)'
2021-07-16 18:54:35,558 | Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven', application_framework=None)'
2021-07-16 18:54:35,560 | Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'
2021-07-16 18:54:35,562 | Registering workflow 'CustomMakeBuilder' with capability 'Capability(language='provided', dependency_manager=None, application_framework=None)'
2021-07-16 18:54:35,562 | Found workflow 'PythonPipBuilder' to support capabilities 'Capability(language='python', dependency_manager='pip', application_framework=None)'
2021-07-16 18:54:35,695 | Running workflow 'PythonPipBuilder'
2021-07-16 18:54:35,696 | Running PythonPipBuilder:ResolveDependencies
2021-07-16 18:54:35,842 | calling pip download -r /Users/kazuki_tsunemi/work/newbiz/products/work/sample-app/hello_world/requirements.txt --dest /var/folders/jq/48y_dvn90c31rdzcs9gw_q4h6wj3s9/T/tmpgpcr3kvf --exists-action i
2021-07-16 18:54:36,669 | Full dependency closure: set()
2021-07-16 18:54:36,670 | initial compatible: set()
2021-07-16 18:54:36,670 | initial incompatible: set()
2021-07-16 18:54:36,670 | Downloading missing wheels: set()
2021-07-16 18:54:36,670 | compatible wheels after second download pass: set()
2021-07-16 18:54:36,670 | Build missing wheels from sdists (C compiling True): set()
2021-07-16 18:54:36,670 | compatible after building wheels (no C compiling): set()
2021-07-16 18:54:36,670 | Build missing wheels from sdists (C compiling False): set()
2021-07-16 18:54:36,670 | compatible after building wheels (C compiling): set()
2021-07-16 18:54:36,670 | Final compatible: set()
2021-07-16 18:54:36,671 | Final incompatible: set()
2021-07-16 18:54:36,671 | Final missing wheels: set()
2021-07-16 18:54:36,671 | PythonPipBuilder:ResolveDependencies succeeded
2021-07-16 18:54:36,671 | Running PythonPipBuilder:CopySource
2021-07-16 18:54:36,676 | PythonPipBuilder:CopySource succeeded
Build Succeeded
Built Artifacts : .aws-sam/build
Built Template : .aws-sam/build/template.yaml
Commands you can use next
=========================
[*] Invoke Function: sam local invoke
[*] Deploy: sam deploy --guided
2021-07-16 18:54:36,680 | Sending Telemetry: {'metrics': [{'commandRun': {'requestId': '21aee255-a1ef-4c71-8278-e5c5075d8fdc', 'installationId': 'fa321107-923d-42cc-ba54-6ea6a3f51b3d', 'sessionId': '73ab7c36-7d90-444b-85e1-0bca5f9ed15c', 'executionEnvironment': 'CLI', 'ci': False, 'pyversion': '3.9.1', 'samcliVersion': '1.26.0', 'awsProfileProvided': False, 'debugFlagProvided': True, 'region': '', 'commandName': 'sam build', 'duration': 1330, 'exitReason': 'success', 'exitCode': 0}}]}
2021-07-16 18:54:37,208 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
.aws-sam
|-- build
| |-- HelloWorldFunction
| | |-- __init__.py
| | |-- app.py
| | `-- requirements.txt
| `-- template.yaml
`-- build.toml
.aws-sam/build do not contains api_shared
Expected result:
.aws-sam
|-- build
| |-- HelloWorldFunction
| | |-- api_shared/ # here
| | |-- __init__.py
| | |-- app.py
| | `-- requirements.txt
| `-- template.yaml
`-- build.toml
Additional environment details
- OS: macOS Catalina 10.15.7
sam --version: 1.26.0- AWS region: build phase issue
Appendex
if package specified with PyPI registered name or git repository url, packages are installed there.
this caused only path format
requirements.txt
requests
result
.aws-sam
├── build
│ ├── HelloWorldFunction
│ │ ├── __init__.py
│ │ ├── app.py
│ │ ├── certifi
│ │ ├── certifi-2021.5.30.dist-info
│ │ ├── charset_normalizer
│ │ ├── charset_normalizer-2.0.2.dist-info
│ │ ├── idna
│ │ ├── idna-3.2.dist-info
│ │ ├── requests
│ │ ├── requests-2.26.0.dist-info
│ │ ├── requirements.txt
│ │ ├── urllib3
│ │ └── urllib3-1.26.6.dist-info
│ └── template.yaml
└── build.toml
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/buildsam build commandsam build commandstage/waiting-for-releaseFix has been merged to develop and is waiting for a releaseFix has been merged to develop and is waiting for a release