mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
fix(AWS Lambda): Ensure proper DependsOn settings when url: true
This commit is contained in:
parent
5af44a478e
commit
2107aec965
@ -659,6 +659,7 @@ class AwsCompileFunctions {
|
||||
AuthType: auth,
|
||||
TargetFunctionArn: resolveLambdaTarget(functionName, functionObject),
|
||||
},
|
||||
DependsOn: _.get(functionObject.targetAlias, 'logicalId'),
|
||||
};
|
||||
|
||||
if (cors) {
|
||||
@ -690,6 +691,7 @@ class AwsCompileFunctions {
|
||||
Principal: '*',
|
||||
FunctionUrlAuthType: auth,
|
||||
},
|
||||
DependsOn: _.get(functionObject.targetAlias, 'logicalId'),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1677,6 +1677,11 @@ describe('lib/plugins/aws/package/compile/functions/index.test.js', () => {
|
||||
},
|
||||
},
|
||||
},
|
||||
fnUrlWithProvisioned: {
|
||||
handler: 'target.handler',
|
||||
url: true,
|
||||
provisionedConcurrency: 1,
|
||||
},
|
||||
},
|
||||
resources: {
|
||||
Resources: {
|
||||
@ -1900,6 +1905,42 @@ describe('lib/plugins/aws/package/compile/functions/index.test.js', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should support `functions[].url` set to `true` with provisionedConcurrency set', () => {
|
||||
expect(
|
||||
cfResources[naming.getLambdaFunctionUrlLogicalId('fnUrlWithProvisioned')].Properties
|
||||
).to.deep.equal({
|
||||
AuthType: 'NONE',
|
||||
TargetFunctionArn: {
|
||||
'Fn::Join': [
|
||||
':',
|
||||
[
|
||||
{
|
||||
'Fn::GetAtt': ['FnUrlWithProvisionedLambdaFunction', 'Arn'],
|
||||
},
|
||||
'provisioned',
|
||||
],
|
||||
],
|
||||
},
|
||||
});
|
||||
expect(
|
||||
cfResources[naming.getLambdaFunctionUrlLogicalId('fnUrlWithProvisioned')].DependsOn
|
||||
).to.equal('FnUrlWithProvisionedProvConcLambdaAlias');
|
||||
|
||||
expect(
|
||||
cfResources[naming.getLambdaFnUrlPermissionLogicalId('fnUrl')].Properties
|
||||
).to.deep.equal({
|
||||
Action: 'lambda:InvokeFunctionUrl',
|
||||
FunctionName: {
|
||||
'Fn::GetAtt': ['FnUrlLambdaFunction', 'Arn'],
|
||||
},
|
||||
FunctionUrlAuthType: 'NONE',
|
||||
Principal: '*',
|
||||
});
|
||||
expect(
|
||||
cfResources[naming.getLambdaFnUrlPermissionLogicalId('fnUrlWithProvisioned')].DependsOn
|
||||
).to.equal('FnUrlWithProvisionedProvConcLambdaAlias');
|
||||
});
|
||||
|
||||
it('should support `functions[].url` set to an object with authorizer and cors', () => {
|
||||
expect(
|
||||
cfResources[naming.getLambdaFunctionUrlLogicalId('fnUrlWithAuthAndCors')].Properties
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user