s3 createObject event not being triggered when a file is uploaded to s3
I am using aws serverless to create a function that is called whenever a new file is uploaded to an s3 bucket. I am subscribing like this.
Hoever, to test it, I upload the file manually from the amazon console, and I expect the function to be executed, but checking CloudWatch logs, nothing seem to be executed.
If I run the lambda function manually everything works fine and I see the logs in Cloudwatch, however is the event triggering what is failing.
FYI: The bucket is created before than the function in a separate cloud formation stack. So bucket and function are not created at the same time.
Any hints?
register:
handler: lib/register.handler
memory: 256
events:
- s3:
bucket: ${self:custom.myBucketArn}
event: s3:ObjectCreated:*
amazon-web-services amazon-s3 aws-lambda serverless aws-serverless
add a comment |
I am using aws serverless to create a function that is called whenever a new file is uploaded to an s3 bucket. I am subscribing like this.
Hoever, to test it, I upload the file manually from the amazon console, and I expect the function to be executed, but checking CloudWatch logs, nothing seem to be executed.
If I run the lambda function manually everything works fine and I see the logs in Cloudwatch, however is the event triggering what is failing.
FYI: The bucket is created before than the function in a separate cloud formation stack. So bucket and function are not created at the same time.
Any hints?
register:
handler: lib/register.handler
memory: 256
events:
- s3:
bucket: ${self:custom.myBucketArn}
event: s3:ObjectCreated:*
amazon-web-services amazon-s3 aws-lambda serverless aws-serverless
Out of interest, did you create the bucket before you deployed the serverless function?
– thomasmichaelwallace
Nov 26 '18 at 13:08
Yes I did. Do you think it might be related to that? I'd be surprised. Because the bucket is created in a separate cloud formation stack. And this should be possible without having to create the bucket and the function at the same time.
– fgonzalez
Nov 26 '18 at 13:23
add a comment |
I am using aws serverless to create a function that is called whenever a new file is uploaded to an s3 bucket. I am subscribing like this.
Hoever, to test it, I upload the file manually from the amazon console, and I expect the function to be executed, but checking CloudWatch logs, nothing seem to be executed.
If I run the lambda function manually everything works fine and I see the logs in Cloudwatch, however is the event triggering what is failing.
FYI: The bucket is created before than the function in a separate cloud formation stack. So bucket and function are not created at the same time.
Any hints?
register:
handler: lib/register.handler
memory: 256
events:
- s3:
bucket: ${self:custom.myBucketArn}
event: s3:ObjectCreated:*
amazon-web-services amazon-s3 aws-lambda serverless aws-serverless
I am using aws serverless to create a function that is called whenever a new file is uploaded to an s3 bucket. I am subscribing like this.
Hoever, to test it, I upload the file manually from the amazon console, and I expect the function to be executed, but checking CloudWatch logs, nothing seem to be executed.
If I run the lambda function manually everything works fine and I see the logs in Cloudwatch, however is the event triggering what is failing.
FYI: The bucket is created before than the function in a separate cloud formation stack. So bucket and function are not created at the same time.
Any hints?
register:
handler: lib/register.handler
memory: 256
events:
- s3:
bucket: ${self:custom.myBucketArn}
event: s3:ObjectCreated:*
amazon-web-services amazon-s3 aws-lambda serverless aws-serverless
amazon-web-services amazon-s3 aws-lambda serverless aws-serverless
edited Nov 26 '18 at 13:24
fgonzalez
asked Nov 26 '18 at 12:57
fgonzalezfgonzalez
1,06631635
1,06631635
Out of interest, did you create the bucket before you deployed the serverless function?
– thomasmichaelwallace
Nov 26 '18 at 13:08
Yes I did. Do you think it might be related to that? I'd be surprised. Because the bucket is created in a separate cloud formation stack. And this should be possible without having to create the bucket and the function at the same time.
– fgonzalez
Nov 26 '18 at 13:23
add a comment |
Out of interest, did you create the bucket before you deployed the serverless function?
– thomasmichaelwallace
Nov 26 '18 at 13:08
Yes I did. Do you think it might be related to that? I'd be surprised. Because the bucket is created in a separate cloud formation stack. And this should be possible without having to create the bucket and the function at the same time.
– fgonzalez
Nov 26 '18 at 13:23
Out of interest, did you create the bucket before you deployed the serverless function?
– thomasmichaelwallace
Nov 26 '18 at 13:08
Out of interest, did you create the bucket before you deployed the serverless function?
– thomasmichaelwallace
Nov 26 '18 at 13:08
Yes I did. Do you think it might be related to that? I'd be surprised. Because the bucket is created in a separate cloud formation stack. And this should be possible without having to create the bucket and the function at the same time.
– fgonzalez
Nov 26 '18 at 13:23
Yes I did. Do you think it might be related to that? I'd be surprised. Because the bucket is created in a separate cloud formation stack. And this should be possible without having to create the bucket and the function at the same time.
– fgonzalez
Nov 26 '18 at 13:23
add a comment |
1 Answer
1
active
oldest
votes
I'm a bit surprised this manage to deploy, as (unless it's been recently addressed) CloudFormation has a limitation that it can only act on its own resources, which means that Serverless cannot attach triggers to buckets not created by that template.
Luckily this limitation is encountered often enough that people have authored Serverless Framework plugins to workaround it. I recommend you use this plug-in to trigger your lambda on an existing bucket:
https://github.com/matt-filion/serverless-external-s3-event
Thanks for the useful explanation
– fgonzalez
Nov 26 '18 at 13:31
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53481628%2fs3-createobject-event-not-being-triggered-when-a-file-is-uploaded-to-s3%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'm a bit surprised this manage to deploy, as (unless it's been recently addressed) CloudFormation has a limitation that it can only act on its own resources, which means that Serverless cannot attach triggers to buckets not created by that template.
Luckily this limitation is encountered often enough that people have authored Serverless Framework plugins to workaround it. I recommend you use this plug-in to trigger your lambda on an existing bucket:
https://github.com/matt-filion/serverless-external-s3-event
Thanks for the useful explanation
– fgonzalez
Nov 26 '18 at 13:31
add a comment |
I'm a bit surprised this manage to deploy, as (unless it's been recently addressed) CloudFormation has a limitation that it can only act on its own resources, which means that Serverless cannot attach triggers to buckets not created by that template.
Luckily this limitation is encountered often enough that people have authored Serverless Framework plugins to workaround it. I recommend you use this plug-in to trigger your lambda on an existing bucket:
https://github.com/matt-filion/serverless-external-s3-event
Thanks for the useful explanation
– fgonzalez
Nov 26 '18 at 13:31
add a comment |
I'm a bit surprised this manage to deploy, as (unless it's been recently addressed) CloudFormation has a limitation that it can only act on its own resources, which means that Serverless cannot attach triggers to buckets not created by that template.
Luckily this limitation is encountered often enough that people have authored Serverless Framework plugins to workaround it. I recommend you use this plug-in to trigger your lambda on an existing bucket:
https://github.com/matt-filion/serverless-external-s3-event
I'm a bit surprised this manage to deploy, as (unless it's been recently addressed) CloudFormation has a limitation that it can only act on its own resources, which means that Serverless cannot attach triggers to buckets not created by that template.
Luckily this limitation is encountered often enough that people have authored Serverless Framework plugins to workaround it. I recommend you use this plug-in to trigger your lambda on an existing bucket:
https://github.com/matt-filion/serverless-external-s3-event
answered Nov 26 '18 at 13:27
thomasmichaelwallacethomasmichaelwallace
2,8101919
2,8101919
Thanks for the useful explanation
– fgonzalez
Nov 26 '18 at 13:31
add a comment |
Thanks for the useful explanation
– fgonzalez
Nov 26 '18 at 13:31
Thanks for the useful explanation
– fgonzalez
Nov 26 '18 at 13:31
Thanks for the useful explanation
– fgonzalez
Nov 26 '18 at 13:31
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53481628%2fs3-createobject-event-not-being-triggered-when-a-file-is-uploaded-to-s3%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Out of interest, did you create the bucket before you deployed the serverless function?
– thomasmichaelwallace
Nov 26 '18 at 13:08
Yes I did. Do you think it might be related to that? I'd be surprised. Because the bucket is created in a separate cloud formation stack. And this should be possible without having to create the bucket and the function at the same time.
– fgonzalez
Nov 26 '18 at 13:23