【以下的问题经过翻译处理】 介绍
我使用gdk component build
生成了一个组件的artifacts和recipe,并位于生成的greengrass-build
文件夹中。
文件夹结构屏幕截图如下。

这是生成的recipe.yml
文件。gdk
已配置为构建artifacts为zip。
ComponentConfiguration:
DefaultConfiguration:
accessControl:
aws.greengrass.ipc.mqttproxy:
com.twisthink.SystemController:mqttproxy:1:
operations:
- aws.greengrass#SubscribeToIoTCore
policyDescription: 允许访问订阅 IoT Core 主题
resources:
- $aws/things/{iot:thingName}/jobs/get/accepted
- $aws/things/{iot:thingName}/jobs/get/rejected
com.twisthink.SystemController:mqttproxy:2:
operations:
- aws.greengrass#PublishToIoTCore
policyDescription: 允许访问发布到 IoT Core 主题
resources:
- $aws/things/{iot:thingName}/jobs/get
ComponentDescription: 这是用Python编写的简单的Hello World组件。
ComponentName: myExample
ComponentPublisher: myname
ComponentVersion: 1.0.1
Manifests:
- Artifacts:
- URI: s3://BUCKET_NAME/COMPONENT_NAME/COMPONENT_VERSION/example.zip
Unarchive: ZIP
Lifecycle:
Run:
RequiresPrivilege: true
Script: sudo python3 {artifacts:decompressedPath}/example/main.py
Platform:
os: linux
RecipeFormatVersion: '2020-01-25'
接下来,我运行以下命令本地部署组件。
cd greengrass-build
sudo greengrass-cli deployment create --recipeDir recipes --artifactDir artifacts --merge "myExample=1.0.1"
问题
我在....greengrass/v2/logs/myExample.log
中看到报错如下:
2023-02-10T21:10:17.518Z [WARN] (Copier) myExample: stderr. File "/home/me/greengrass/v2/packages/artifacts-unarchived/myExample/1.0.1/example/main.py", line 41, in init. {scriptName=services.myExample.lifecycle.Run.Script, serviceName=myExample, currentState=RUNNING}
2023-02-10T21:10:17.518Z [WARN] (Copier) myExample: stderr. self.ipc_client_v2 = GreengrassCoreIPCClientV2(). {scriptName=services.myExample.lifecycle.Run.Script, serviceName=myExample, currentState=RUNNING}
2023-02-10T21:10:17.518Z [WARN] (Copier) myExample: stderr. File "/usr/local/lib/python3.8/dist-packages/awsiot/greengrasscoreipc/clientv2.py", line 31, in init. {scriptName=services.myExample.lifecycle.Run.Script, serviceName=myExample, currentState=RUNNING}
2023-02-10T21:10:17.518Z [WARN] (Copier) myExample: stderr. client = awsiot.greengrasscoreipc.connect(). {scriptName=services.myExample.lifecycle.Run.Script, serviceName=myExample, currentState=RUNNING}
2023-02-10T21:10:17.518Z [WARN] (Copier) myExample: stderr. File "/usr/local/lib/python3.8/dist-packages/awsiot/greengrasscoreipc/init.py", line 45, in connect. {scriptName=services.myExample.lifecycle.Run.Script, serviceName=myExample, currentState=RUNNING}
2023-02-10T21:10:17.518Z [WARN] (Copier) myExample: stderr. ipc_socket = os.environ["AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT"]. {scriptName=services.myExample.lifecycle.Run.Script, serviceName=myExample, currentState=RUNNING}
2023-02-10T21:10:17.518Z [WARN] (Copier) myExample: stderr. File "/usr/lib/python3.8/os.py", line 675, in getitem. {scriptName=services.myExample.lifecycle.Run.Script, serviceName=myExample, currentState=RUNNING}
2023-02-10T21:10:17.518Z [WARN] (Copier) myExample: stderr. raise KeyError(key) from None. {scriptName=services.myExample.lifecycle.Run.Script, serviceName=myExample, currentState=RUNNING}
2023-02-10T21:10:17.518Z [WARN] (Copier) myExample: stderr. KeyError: 'AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT'. {scriptName=services.myExample.lifecycle.Run.Script, serviceName=myExample, currentState=RUNNING}
2023-02-10T21:10:17.540Z [INFO] (Copier) myExample: Run script exited. {exitCode=1, serviceName=myExample, currentState=RUNNING}
为什么会报 AWS_GG_NUCLEUS_DOMAIN_SOCKET_FILEPATH_FOR_COMPONENT missing的错误?怎么解决这个问题?P S 使用non-zipped的包的时候我没有这个报错