mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Merge branch 'master' into improve-promised-bdd-setup
This commit is contained in:
commit
7f1dbbced8
@ -8,12 +8,6 @@ matrix:
|
||||
- secure: p9ka7mRzo/ecjnDh/dz19g0iVfQdvsGRAtg/4ONeiq75I2+oqHzu+VxUBA1Z2IQbpCEAMo21CarR3fg2I6MFUeazL0nEpqr1PoOAI8nPFeQlg/h+jLXsrPAkDcu2/b8ij7J5MXeLdZXUVqiPcGkr68x/tCMk/rwxftljQhvXPQfc7Lxm/m61ELnC7rLJulhxWZLNIq1hwQ9nh0GMKb4hm0KmPn8ksccVL+wyDikkgXCuvIujhTBjhNivAe4mG8mqnNsW1Ugh++SUe1ld27TtbH7wQj02SSG4Bxfwc3Gz0GFdAL1GyOkWI2WvrqP4a0KYTRUo+pUr9E+HZ1SNlxU5t6QWtmDiy5MKkxzgeTXmkKiJ98vMlF0ja5bpp46NjYarzDafqE8FozHzLtr+uAtqr6gRAgU1rWaG9BE3gKeW/f4B/2MfPI26b7SxuU1MwGVy0I76hb0Ujbgb3X8G4TYTGb6Nhoewc+RZExPwVhfrN8cJjo45masndv5tQAZMSRX/JUFjs4h/QMXNsn0A53GXgf6eIzUu15m+W8TJYFiKQeq9nMejzEE4sWMO3BFnkxueBGVCEurOc1GgdEnKxeqlp+psxHcJRlNCxC1HkUVOzfpkCr/Jy42vM8jQomAMv41Z9zWjOagVphWT25xNeSILfRt4yPku5wfW4CAxp+fl4KQ=
|
||||
include:
|
||||
# Linux tests
|
||||
- os: linux
|
||||
node_js: "4.4"
|
||||
env: SLS_IGNORE_WARNING=*
|
||||
- os: linux
|
||||
node_js: "5.11"
|
||||
env: SLS_IGNORE_WARNING=*
|
||||
- os: linux
|
||||
node_js: "6.2"
|
||||
env: SLS_IGNORE_WARNING=*
|
||||
|
||||
@ -49,6 +49,10 @@ Any non-backward compatible changes leads to a major version bump. This includes
|
||||
|
||||
If we remove a helper function from the serverless object passed down to a plugin then this is a breaking change since some people might rely on it in custom made plugins.
|
||||
|
||||
### Node.js versions
|
||||
|
||||
The Serverless Framework supports the major cloud providers Node.js runtime versions. Support for old Node.js versions will be removed once Cloud providers announce that such runtimes are not supported anymore.
|
||||
|
||||
### FAQ
|
||||
|
||||
1. Is it okay to mark a feature as deprecated in version 1.4.0 and then remove it in 1.8.0
|
||||
|
||||
@ -499,9 +499,9 @@ functions:
|
||||
- nickname
|
||||
```
|
||||
|
||||
### Using asyncronous integration
|
||||
### Using asynchronous integration
|
||||
|
||||
Use `async: true` when integrating a lambda function using [event invocation](https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#SSS-Invoke-request-InvocationType). This lets API Gateway to return immediately with a 200 status code while the lambda continues running. If not othewise speficied integration type will be `AWS`.
|
||||
Use `async: true` when integrating a lambda function using [event invocation](https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html#SSS-Invoke-request-InvocationType). This lets API Gateway to return immediately with a 200 status code while the lambda continues running. If not otherwise specified integration type will be `AWS`.
|
||||
|
||||
```yml
|
||||
functions:
|
||||
@ -868,7 +868,7 @@ If you want to spread a string into multiple lines, you can use the `>` or `|` s
|
||||
#### Pass Through Behavior
|
||||
API Gateway provides multiple ways to handle requests where the Content-Type header does not match any of the specified mapping templates. When this happens, the request payload will either be passed through the integration request *without transformation* or rejected with a `415 - Unsupported Media Type`, depending on the configuration.
|
||||
|
||||
You can define this behavior as follows (if not specified, a value of **NEVER** will be used):
|
||||
You can define this behaviour as follows (if not specified, a value of **NEVER** will be used):
|
||||
|
||||
```yml
|
||||
functions:
|
||||
@ -1355,6 +1355,8 @@ functions:
|
||||
type: COGNITO_USER_POOLS # TOKEN or REQUEST or COGNITO_USER_POOLS, same as AWS Cloudformation documentation
|
||||
authorizerId:
|
||||
Ref: ApiGatewayAuthorizer # or hard-code Authorizer ID
|
||||
scopes: # Optional - List of Oauth2 scopes when type is COGNITO_USER_POOLS
|
||||
- myapp/myscope
|
||||
|
||||
deleteUser:
|
||||
...
|
||||
|
||||
@ -15,12 +15,18 @@ module.exports = {
|
||||
|
||||
if (http.authorizer) {
|
||||
if (http.authorizer.type && http.authorizer.authorizerId) {
|
||||
return {
|
||||
const authReturn = {
|
||||
Properties: {
|
||||
AuthorizationType: http.authorizer.type,
|
||||
AuthorizerId: http.authorizer.authorizerId,
|
||||
},
|
||||
};
|
||||
if (http.authorizer.type === 'COGNITO_USER_POOLS'
|
||||
&& http.authorizer.scopes
|
||||
&& http.authorizer.scopes.length) {
|
||||
authReturn.Properties.AuthorizationScopes = http.authorizer.scopes;
|
||||
}
|
||||
return authReturn;
|
||||
}
|
||||
|
||||
const authorizerLogicalId = this.provider.naming
|
||||
@ -39,7 +45,7 @@ module.exports = {
|
||||
},
|
||||
DependsOn: authorizerLogicalId,
|
||||
};
|
||||
if (http.authorizer.scopes) {
|
||||
if (http.authorizer.scopes && http.authorizer.scopes.length) {
|
||||
cognitoReturn.Properties.AuthorizationScopes = http.authorizer.scopes;
|
||||
}
|
||||
return cognitoReturn;
|
||||
|
||||
@ -489,7 +489,7 @@ describe('#compileMethods()', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should set custom authorizer config with authorizeId', () => {
|
||||
it('should set custom authorizer config with authorizerId', () => {
|
||||
awsCompileApigEvents.validated.events = [
|
||||
{
|
||||
functionName: 'First',
|
||||
@ -542,7 +542,7 @@ describe('#compileMethods()', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should set authorizer config for a cognito user pool', () => {
|
||||
it('should set authorizer config for a cognito user pool when given authorizer arn', () => {
|
||||
awsCompileApigEvents.validated.events = [
|
||||
{
|
||||
functionName: 'First',
|
||||
@ -583,6 +583,75 @@ describe('#compileMethods()', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should set authorizer config for a cognito user pool when given authorizerId Ref', () => {
|
||||
awsCompileApigEvents.validated.events = [
|
||||
{
|
||||
functionName: 'First',
|
||||
http: {
|
||||
authorizer: {
|
||||
name: 'authorizer',
|
||||
type: 'COGNITO_USER_POOLS',
|
||||
authorizerId: { Ref: 'CognitoAuthorizer' },
|
||||
scopes: ['myapp/read', 'myapp/write'],
|
||||
},
|
||||
integration: 'AWS',
|
||||
path: 'users/create',
|
||||
method: 'post',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
return awsCompileApigEvents.compileMethods().then(() => {
|
||||
expect(
|
||||
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Resources.ApiGatewayMethodUsersCreatePost.Properties.AuthorizationType
|
||||
).to.equal('COGNITO_USER_POOLS');
|
||||
|
||||
expect(
|
||||
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Resources.ApiGatewayMethodUsersCreatePost.Properties.AuthorizationScopes
|
||||
).to.contain('myapp/read');
|
||||
|
||||
expect(
|
||||
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Resources.ApiGatewayMethodUsersCreatePost.Properties.AuthorizerId.Ref
|
||||
).to.equal('CognitoAuthorizer');
|
||||
|
||||
expect(
|
||||
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Resources.ApiGatewayMethodUsersCreatePost.Properties
|
||||
.Integration.RequestTemplates['application/json']
|
||||
).to.not.match(/undefined/);
|
||||
});
|
||||
});
|
||||
|
||||
it('should not scopes for a cognito user pool when given empty scopes array', () => {
|
||||
awsCompileApigEvents.validated.events = [
|
||||
{
|
||||
functionName: 'First',
|
||||
http: {
|
||||
authorizer: {
|
||||
name: 'authorizer',
|
||||
type: 'COGNITO_USER_POOLS',
|
||||
authorizerId: { Ref: 'CognitoAuthorizer' },
|
||||
scopes: [],
|
||||
},
|
||||
integration: 'AWS',
|
||||
path: 'users/create',
|
||||
method: 'post',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
return awsCompileApigEvents.compileMethods().then(() => {
|
||||
expect(
|
||||
awsCompileApigEvents.serverless.service.provider.compiledCloudFormationTemplate
|
||||
.Resources.ApiGatewayMethodUsersCreatePost.Properties
|
||||
).to.not.have.property('AuthorizationScopes');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should set claims for a cognito user pool', () => {
|
||||
awsCompileApigEvents.validated.events = [
|
||||
{
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
"name": "serverless",
|
||||
"version": "1.43.0",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"engineStrict": true,
|
||||
"preferGlobal": true,
|
||||
"homepage": "https://github.com/serverless/serverless#readme",
|
||||
"description": "Serverless Framework - Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user