The following if my lambda code where if i run locally (without lambda) it works, but when I throw it in lambda it throws "errorMessage": "No launch paths found for resource: prod-hyaxfulvfdtm2"
while trying to create a provisioned product in AWS service catalog:
// 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)
//})()
If I uncomment that bottom async function & run locally with node
then it will create the provisioned product.
I seem to have resolved this issue by adding the role that is already attached to my lambda function as an authorized role in my service catalog portfolio.