I am excluding aws-sdk in my webpack bundle for Lambda
up vote
2
down vote
favorite
When webpacking for lambda, I am removing aws-sdk completely from the webpack bundle since lambda has it built-in. However, it seems to be throwing errors. Is there a way to specify that it needs to use the lambda's aws-sdk? If I do node index.js (the webpack output file), I get an error saying that aws-sdk doesn't exist. Since lambda has aws-sdk built in, I assumed if I upload the zipped file to lambda, it would understand it. However, I'm getting an error in Lambda CloudWatch console saying Unable to import module 'index'
amazon-web-services aws-sdk aws-sdk-js aws-sdk-nodejs
add a comment |
up vote
2
down vote
favorite
When webpacking for lambda, I am removing aws-sdk completely from the webpack bundle since lambda has it built-in. However, it seems to be throwing errors. Is there a way to specify that it needs to use the lambda's aws-sdk? If I do node index.js (the webpack output file), I get an error saying that aws-sdk doesn't exist. Since lambda has aws-sdk built in, I assumed if I upload the zipped file to lambda, it would understand it. However, I'm getting an error in Lambda CloudWatch console saying Unable to import module 'index'
amazon-web-services aws-sdk aws-sdk-js aws-sdk-nodejs
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
When webpacking for lambda, I am removing aws-sdk completely from the webpack bundle since lambda has it built-in. However, it seems to be throwing errors. Is there a way to specify that it needs to use the lambda's aws-sdk? If I do node index.js (the webpack output file), I get an error saying that aws-sdk doesn't exist. Since lambda has aws-sdk built in, I assumed if I upload the zipped file to lambda, it would understand it. However, I'm getting an error in Lambda CloudWatch console saying Unable to import module 'index'
amazon-web-services aws-sdk aws-sdk-js aws-sdk-nodejs
When webpacking for lambda, I am removing aws-sdk completely from the webpack bundle since lambda has it built-in. However, it seems to be throwing errors. Is there a way to specify that it needs to use the lambda's aws-sdk? If I do node index.js (the webpack output file), I get an error saying that aws-sdk doesn't exist. Since lambda has aws-sdk built in, I assumed if I upload the zipped file to lambda, it would understand it. However, I'm getting an error in Lambda CloudWatch console saying Unable to import module 'index'
amazon-web-services aws-sdk aws-sdk-js aws-sdk-nodejs
amazon-web-services aws-sdk aws-sdk-js aws-sdk-nodejs
asked Nov 19 at 15:52
Jesse Lee
133
133
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
You want to use webpack's Externals, rather than ignore.
Try adding this to your webpack config:
externals: {
'aws-sdk': 'aws-sdk'
}
That will keep aws-sdk from being bundled into index.js, and will instead use lambda-provided aws-sdk instead.
thanks for selecting
– gatsbyz
Nov 19 at 16:13
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
You want to use webpack's Externals, rather than ignore.
Try adding this to your webpack config:
externals: {
'aws-sdk': 'aws-sdk'
}
That will keep aws-sdk from being bundled into index.js, and will instead use lambda-provided aws-sdk instead.
thanks for selecting
– gatsbyz
Nov 19 at 16:13
add a comment |
up vote
2
down vote
accepted
You want to use webpack's Externals, rather than ignore.
Try adding this to your webpack config:
externals: {
'aws-sdk': 'aws-sdk'
}
That will keep aws-sdk from being bundled into index.js, and will instead use lambda-provided aws-sdk instead.
thanks for selecting
– gatsbyz
Nov 19 at 16:13
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
You want to use webpack's Externals, rather than ignore.
Try adding this to your webpack config:
externals: {
'aws-sdk': 'aws-sdk'
}
That will keep aws-sdk from being bundled into index.js, and will instead use lambda-provided aws-sdk instead.
You want to use webpack's Externals, rather than ignore.
Try adding this to your webpack config:
externals: {
'aws-sdk': 'aws-sdk'
}
That will keep aws-sdk from being bundled into index.js, and will instead use lambda-provided aws-sdk instead.
answered Nov 19 at 15:53
gatsbyz
304315
304315
thanks for selecting
– gatsbyz
Nov 19 at 16:13
add a comment |
thanks for selecting
– gatsbyz
Nov 19 at 16:13
thanks for selecting
– gatsbyz
Nov 19 at 16:13
thanks for selecting
– gatsbyz
Nov 19 at 16:13
add a comment |
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%2f53378273%2fi-am-excluding-aws-sdk-in-my-webpack-bundle-for-lambda%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