我正在尝试使用 SAM-cli 在 PyCharm 中本地调试 Lambda。
为了让这个 Lambda 工作,我有一个链接到它的层,它工作得很好。现在,如果我在 Lambda 代码中设置断点,一切都很好,执行在断点处停止。但是,如果我在层代码中设置断点,则不会考虑在内。
我认为问题来自层文件的映射,导致sam local invoke xxxx
调用命令时,我收到警告说pydev debugger: warning: trying to add breakpoint to file that does not exist: /home/arobin/Documents/projects/edfred-distributed-cicd/shared/services/publishers/sensorbox_publisher.py (will have no effect)
。
这是我的 template.yml 文件:
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An AWS Serverless Specification template describing your function.
Resources:
shared:
Type: AWS::Serverless::LayerVersion
Properties:
ContentUri: ./shared
Metadata:
BuildMethod: python3.6
lamdistributeddatapublishersceptreprd:
Type: AWS::Serverless::Function
Properties:
Handler: publisher/index.run
Runtime: python3.6
CodeUri: ./data-pipe
Layers:
- !Ref shared
Description: ''
MemorySize: 1024
Timeout: 900
Role: >-
arn:aws:iam::045217667925:role/edfred-platformdev-distributeddata-role-lambda-sceptre-prd
VpcConfig:
SecurityGroupIds:
- sg-0aa5f8f912ce37ff3
SubnetIds:
- subnet-e2b569aa
- subnet-2f3b3374
Environment:
Variables:
SENSORBOX_PUBLISHER_QUEUE: >-
https://sqs.eu-west-1.amazonaws.com/045217667925/sqs-sensorbox-publisher-queue-sceptre-prd
IO_MEASURE_ON_DEMAND_PUBLISHER_QUEUE: >-
https://sqs.eu-west-1.amazonaws.com/045217667925/sqs-io-measure-on-demand-publisher-queue-sceptre-prd
MIP_FTP_FOLDER_WEBBOX: webbox-prd
ACK_BUCKET: edfred-edfre-prd-s3-eu-west-1-distributed-acknowledgment
ALARM_PUBLISHER_QUEUE: >-
https://sqs.eu-west-1.amazonaws.com/045217667925/sqs-alarm-publisher-queue-sceptre-prd
HARVEST_BUCKET: edfred-edfre-prd-s3-eu-west-1-distributed-harvest
RDS_DB_PORT: '5432'
METER_ON_DEMAND_PUBLISHER_QUEUE: >-
https://sqs.eu-west-1.amazonaws.com/045217667925/sqs-meter-on-demand-publisher-queue-sceptre-prd
INI_BUCKET: edfred-edfre-prd-s3-eu-west-1-distributed-ini
TOR_PUBLISHER_QUEUE: >-
https://sqs.eu-west-1.amazonaws.com/045217667925/sqs-tor-publisher-queue-sceptre-prd
MIP_FTP_URL: mip.photon-tec.fr
MIP_FTP_DONE_PREFIX: done
LOG_LEVEL: '20'
ADM_DB_PASSWORD_SSM_PARAMETER_NAME: /Distributed/Aurora/Password
RDS_DB_HOST: >-
edfred-sceptre-prd-eu-west-1-distributedapi-instance.ccpyauuephzf.eu-west-1.rds.amazonaws.com
MAPPING_VARS_BUCKET: edfred-edfre-prd-s3-eu-west-1-distributed-mapping-vars
SENSORBOX_ON_DEMAND_PUBLISHER_QUEUE: >-
https://sqs.eu-west-1.amazonaws.com/045217667925/sqs-sensorbox-on-demand-publisher-queue-sceptre-prd
GATEWAY_COMMUNICATION_QUEUE: >-
https://sqs.eu-west-1.amazonaws.com/045217667925/sqs-gateway-communication-queue-sceptre-prd
ADM_DB_PORT: '5432'
MIP_FTP_DOWNLOAD_MAX_FILES: '100'
RDS_DB_USER: enrs
MIP_FTP_FOLDER_WEBDYN: webdyn-prd
RDS_DB_NAME: distributedapi_db
INVERTER_PUBLISHER_QUEUE: >-
https://sqs.eu-west-1.amazonaws.com/045217667925/sqs-inverter-publisher-queue-sceptre-prd
MIP_FTP_USER: admin-mip2-prd
RDS_DB_PASSWORD_SSM_PARAMETER_NAME: /Aurora/Enrs/Password
ADM_DB_HOST: >-
edfred-sceptre-prd-eu-west-1-distributedadm-instance.ccpyauuephzf.eu-west-1.rds.amazonaws.com
IO_MEASURE_PUBLISHER_QUEUE: >-
https://sqs.eu-west-1.amazonaws.com/045217667925/sqs-io-measure-publisher-queue-sceptre-prd
ADM_DB_USER: db_adm_user
CURATED_BUCKET: edfred-edfre-prd-s3-eu-west-1-distributed-curated
ADM_DB_NAME: distributedadm_db
METER_PUBLISHER_QUEUE: >-
https://sqs.eu-west-1.amazonaws.com/045217667925/sqs-meter-publisher-queue-sceptre-prd
SOLAREDGE_API_KEY_SSM_PARAMETER_NAME: solaredge
GATEWAYS_BUCKET: edfred-edfre-prd-s3-eu-west-1-distributed-gateways
PRECURATED_BUCKET: edfred-edfre-prd-s3-eu-west-1-distributed-pre-curated
MIP_FTP_PASSWORD_SSM_PARAMETER: /distributed/ftp/password
MIP_FTP_TOP_DIR: /
STAGE: sceptre-prd
INVERTER_ON_DEMAND_PUBLISHER_QUEUE: >-
https://sqs.eu-west-1.amazonaws.com/045217667925/sqs-inverter-on-demand-publisher-queue-sceptre-prd