mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Fix s3 is undefined bug
This commit is contained in:
parent
5eed5c3621
commit
8ea06053a2
@ -42,7 +42,9 @@ class AwsCompileS3Events {
|
||||
this.serverless.service.getAllFunctions().forEach((functionName) => {
|
||||
const s3BucketObject = this.serverless.service.getFunction(functionName);
|
||||
|
||||
if (s3BucketObject.events.aws.s3) {
|
||||
// checking all three levels in the obj tree
|
||||
// to avoid "can't read property of undefined" error
|
||||
if (s3BucketObject.events && s3BucketObject.events.aws && s3BucketObject.events.aws.s3) {
|
||||
// iterate over all defined buckets
|
||||
s3BucketObject.events.aws.s3.forEach((bucketName) => {
|
||||
// 1. create the S3 bucket with the corresponding notification
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user