如果我的 lambda 代码在本地运行(没有 lambda),则以下内容可以正常工作,但是当我将其放入 lambda 中时,它会"errorMessage": "No launch paths found for resource: prod-hyaxfulvfdtm2"
在尝试在 AWS 服务目录中创建预置产品时抛出:
// import AWS from 'aws-sdk';
import { ServiceCatalogClient, ProvisionProductCommand } from '@aws-sdk/client-service-catalog';
const client = new ServiceCatalogClient({region: 'us-west-2'});
export const Handler = async (event: any = {
}): Promise<any> => {
try {
const cmd = new ProvisionProductCommand({
ProvisionedProductName: event.ProvisionedProductName,
ProductId: event.ProductId,
ProvisioningArtifactId: event.ProvisioningArtifactId,
ProvisioningParameters: [
{
Key: 'AccountEmail',
Value: event.AccountEmail
},{
Key: 'AccountName',
Value: event.AccountName
},{
Key: 'ManagedOrganizationalUnit',
Value: event.ManagedOrganizationalUnit
},{
Key: 'SSOUserEmail',
Value: event.SSOUserEmail
},{
Key: 'SSOUserFirstName',
Value: event.SSOUserFirstName
},{
Key: 'SSOUserLastName',
Value: event.SSOUserLastName
}
],
});
{
}
const result = await client.send(cmd);
return {
statusCode: 200,
body: JSON.stringify(result)
}
} catch (error) {
throw(error)
}
}
//(async () => {
// const result = await Handler()
// console.log("RESULT: ", result)
//})()
如果我取消注释该底部异步功能并在本地运行,node
那么它将创建配置的产品。