mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
fix(AWS API Gateway): Fix support for provider.apiGateway.stage
(PR #11772)
This commit is contained in:
parent
86a55950f8
commit
6fe2ea5bc8
@ -13,7 +13,7 @@ module.exports = {
|
||||
Type: 'AWS::ApiGateway::Deployment',
|
||||
Properties: {
|
||||
RestApiId: this.provider.getApiGatewayRestApiId(),
|
||||
StageName: this.provider.getStage(),
|
||||
StageName: this.provider.getApiGatewayStage(),
|
||||
Description: this.provider.getApiGatewayDescription(),
|
||||
},
|
||||
DependsOn: this.apiGatewayMethodLogicalIds,
|
||||
|
||||
@ -5,4 +5,4 @@ module.exports = {
|
||||
"path": "resources"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -407,4 +407,25 @@ describe('test/unit/lib/plugins/aws/package/compile/events/apiGateway/lib/stage/
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('should use stage name from provider if provider.apiGateway.stage is configured', async () => {
|
||||
// https://github.com/serverless/serverless/issues/11675
|
||||
const { cfTemplate, awsNaming } = await runServerless({
|
||||
fixture: 'api-gateway',
|
||||
command: 'package',
|
||||
configExt: {
|
||||
provider: {
|
||||
apiGateway: {
|
||||
stage: 'foo',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(awsNaming.provider.getApiGatewayStage()).to.equal('foo');
|
||||
const [apiGatewayDeploymentKey] = Object.keys(cfTemplate.Resources).filter((k) =>
|
||||
k.startsWith('ApiGatewayDeployment')
|
||||
);
|
||||
const apiGatewayDeployment = cfTemplate.Resources[apiGatewayDeploymentKey];
|
||||
expect(apiGatewayDeployment.Properties.StageName).to.equal('foo');
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user