Error compiling TS lambda function that imports aws-sdk

Hi I have a problem with building of TS lambda functions, been getting the following error:

12:27:04 AM:  > src/functions/email-verification-request.ts:6:16: error: Could not resolve "aws-sdk" (mark it as external to exclude it from the bundle)
12:27:04 AM:     6 │ import AWS from 'aws-sdk';
12:27:04 AM:       ╵                 ~~~~~~~~~

I’ll post the full build log below

12:25:10 AM: Build ready to start
12:25:12 AM: build-image version: 0582042f4fc261adc7bd8333f34884959c577302
12:25:12 AM: build-image tag: v3.7.6
12:25:12 AM: buildbot version: d3b46eed9a3db45474c8cf94296b8a366d780a85
12:25:12 AM: Fetching cached dependencies
12:25:13 AM: Starting to download cache of 151.5MB
12:25:14 AM: Finished downloading cache in 2.13038407s
12:25:14 AM: Starting to extract cache
12:25:20 AM: Finished extracting cache in 5.303659012s
12:25:20 AM: Finished fetching cache in 7.474783026s
12:25:20 AM: Starting to prepare the repo for build
12:25:20 AM: Preparing Git Reference refs/heads/pwa
12:25:22 AM: Parsing package.json dependencies
12:25:23 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'dist/pwa' versus 'dist/' in the Netlify UI
12:25:23 AM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'src/functions' versus '' in the Netlify UI
12:25:23 AM: Different build command detected, going to use the one specified in the Netlify configuration file: 'yarn build && cp _redirects dist/pwa' versus 'yarn build' in the Netlify UI
12:25:23 AM: Starting build script
12:25:23 AM: Installing dependencies
12:25:23 AM: Python version set to 2.7
12:25:23 AM: Started restoring cached node version
12:25:26 AM: Finished restoring cached node version
12:25:26 AM: v12.18.0 is already installed.
12:25:27 AM: Now using node v12.18.0 (npm v6.14.4)
12:25:27 AM: Started restoring cached build plugins
12:25:27 AM: Finished restoring cached build plugins
12:25:27 AM: Attempting ruby version 2.7.1, read from environment
12:25:28 AM: Using ruby version 2.7.1
12:25:29 AM: Using PHP version 5.6
12:25:29 AM: Started restoring cached yarn cache
12:25:29 AM: Finished restoring cached yarn cache
12:25:29 AM: No yarn workspaces detected
12:25:29 AM: Started restoring cached node modules
12:25:29 AM: Finished restoring cached node modules
12:25:29 AM: Installing NPM modules using Yarn version 1.22.4
12:25:30 AM: yarn install v1.22.4
12:25:30 AM: [1/5] Validating package.json...
12:25:30 AM: [2/5] Resolving packages...
12:25:31 AM: [3/5] Fetching packages...
12:26:04 AM: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
12:26:04 AM: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
12:26:04 AM: info fsevents@2.3.1: The platform "linux" is incompatible with this module.
12:26:04 AM: info "fsevents@2.3.1" is an optional dependency and failed compatibility check. Excluding it from installation.
12:26:04 AM: info fsevents@1.2.13: The platform "linux" is incompatible with this module.
12:26:04 AM: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
12:26:04 AM: info @netlify/traffic-mesh-agent-darwin-x64@0.27.10: The platform "linux" is incompatible with this module.
12:26:04 AM: info "@netlify/traffic-mesh-agent-darwin-x64@0.27.10" is an optional dependency and failed compatibility check. Excluding it from installation.
12:26:04 AM: info @netlify/traffic-mesh-agent-win32-x64@0.27.10: The platform "linux" is incompatible with this module.
12:26:04 AM: info "@netlify/traffic-mesh-agent-win32-x64@0.27.10" is an optional dependency and failed compatibility check. Excluding it from installation.
12:26:04 AM: [4/5] Linking dependencies...
12:26:04 AM: warning " > vue-instantsearch@3.4.3" has unmet peer dependency "vue@^2.6.0".
12:26:04 AM: warning " > vue-instantsearch@3.4.3" has unmet peer dependency "vue-server-renderer@^2.6.11".
12:26:04 AM: warning " > workbox-webpack-plugin@5.1.4" has unmet peer dependency "webpack@^4.0.0".
12:26:04 AM: warning " > eslint-loader@3.0.4" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
12:26:04 AM: warning "netlify-cli > @netlify/plugin-edge-handlers > @rollup/plugin-commonjs@17.1.0" has incorrect peer dependency "rollup@^2.30.0".
12:26:16 AM: [5/5] Building fresh packages...
12:26:18 AM: Done in 48.38s.
12:26:18 AM: NPM modules installed using Yarn
12:26:18 AM: Started restoring cached go cache
12:26:19 AM: Finished restoring cached go cache
12:26:19 AM: go version go1.14.4 linux/amd64
12:26:19 AM: go version go1.14.4 linux/amd64
12:26:19 AM: Installing missing commands
12:26:19 AM: Verify run directory
12:26:20 AM: ​
12:26:20 AM: ────────────────────────────────────────────────────────────────
12:26:20 AM:   Netlify Build                                                 
12:26:20 AM: ────────────────────────────────────────────────────────────────
12:26:20 AM: ​
12:26:20 AM: ❯ Version
12:26:20 AM:   @netlify/build 11.14.0
12:26:20 AM: ​
12:26:20 AM: ❯ Flags
12:26:20 AM:   deployId: 609d52e648f5e40007f25d5e
12:26:20 AM: ​
12:26:20 AM: ❯ Current directory
12:26:20 AM:   /opt/build/repo
12:26:20 AM: ​
12:26:20 AM: ❯ Config file
12:26:20 AM:   /opt/build/repo/netlify.toml
12:26:20 AM: ​
12:26:20 AM: ❯ Context
12:26:20 AM:   branch-deploy
12:26:20 AM: ​
12:26:20 AM: ❯ Loading plugins
12:26:20 AM:    - netlify-plugin-inline-functions-env@1.0.8 from netlify.toml
12:26:21 AM: ​
12:26:21 AM: ──────────────────────────────────────────────────────────────────
12:26:21 AM:   1. onPreBuild command from netlify-plugin-inline-functions-env  
12:26:21 AM: ──────────────────────────────────────────────────────────────────
12:26:21 AM: ​
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/function-config.js
12:26:24 AM: inlining /opt/build/repo/src/functions/access-token-linkedin.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/currency.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/offer.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/voucher-utils.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/chat-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/twilio.js
12:26:24 AM: inlining /opt/build/repo/src/functions/chat-access-token.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/chat.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/chat-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/twilio.js
12:26:24 AM: inlining /opt/build/repo/src/functions/chat-create-conversation.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/currency.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/voucher.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/offer.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/voucher-utils.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/account-management.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/function-config.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functions/email-verification-finish.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/aws.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie.js
12:26:24 AM: inlining /opt/build/repo/src/functions/graphql.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/linkedin-pdf-to-json.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/pdf-text.js
12:26:24 AM: inlining /opt/build/repo/src/functions/linkedin-upload-resume.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functions/login.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functions/logout.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/aws.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/function-config.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functions/oauth-facebook.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/function-config.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functions/oauth-google.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functions/order-cancel.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/work-order.js
12:26:24 AM: inlining /opt/build/repo/src/functions/order-fulfill.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/twilio.js
12:26:24 AM: inlining /opt/build/repo/src/functions/pn-notify-register.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/account-management.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functions/reset-password-finish.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/aws.js
12:26:24 AM: inlining /opt/build/repo/src/functions/search-images.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/reviews.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/work-order.js
12:26:24 AM: inlining /opt/build/repo/src/functions/service-review-create.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functions/signup.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/aws.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/user-notification.js
12:26:24 AM: inlining /opt/build/repo/src/functions/social-post-like.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/graphql.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/social-post-config.js
12:26:24 AM: inlining /opt/build/repo/src/functions/social-post-save.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/auth.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/cookie-parser.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/errors.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/graphql.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/social-post-config.js
12:26:24 AM: inlining /opt/build/repo/src/functions/social-post-track-view.js
12:26:24 AM: inlining /opt/build/repo/src/functions/version-check.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/fdb-client.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/lambdaHelpers/voucher.js
12:26:24 AM: inlining /opt/build/repo/src/functionUtils/voucher-utils.js
12:26:26 AM: ​
12:26:26 AM: (netlify-plugin-inline-functions-env onPreBuild completed in 5.7s)
12:26:26 AM: ​
12:26:26 AM: ────────────────────────────────────────────────────────────────
12:26:26 AM:   2. build.command from netlify.toml                            
12:26:26 AM: ────────────────────────────────────────────────────────────────
12:26:26 AM: ​
12:26:26 AM: $ yarn build && cp _redirects dist/pwa
12:26:27 AM: yarn run v1.22.4
12:26:27 AM: $ node write-redirects && quasar build -m pwa
12:26:27 AM: Generated _redirects
12:26:27 AM:  Build mode........ pwa
12:26:27 AM:  Pkg quasar........ v1.15.0
12:26:27 AM:  Pkg @quasar/app... v2.1.14
12:26:27 AM:  Debugging......... no
12:26:27 AM:  Publishing........ no
12:26:27 AM:  Configured browser support (at least 87.82% of global marketshare):
12:26:27 AM:  · Chrome for Android >= 90
12:26:27 AM:  · Firefox for Android >= 87
12:26:27 AM:  · Android >= 90
12:26:27 AM:  · Chrome >= 80
12:26:27 AM:  · Edge >= 87
12:26:27 AM:  · Firefox >= 78
12:26:27 AM:  · iOS >= 10.3
12:26:27 AM:  · Opera >= 71
12:26:27 AM:  · Safari >= 11
12:26:27 AM:  App · Reading quasar.conf.js
12:26:27 AM:  App · Transpiling JS (Babel active)
12:26:29 AM:  App · [InjectManifest] Using your custom service-worker written file
12:26:29 AM:  App · Extending PWA Webpack config
12:26:29 AM:  App · Cleaned build artifact: "/opt/build/repo/dist/pwa"
12:26:29 AM:  App · Generating Webpack entry point
12:26:29 AM:  App · Compiling with Webpack...
12:26:29 AM:  App · Compiling PWA...
12:26:55 AM:  App · Compiled PWA done in 25944 ms
12:26:55 AM:  App · Added build artifact "/opt/build/repo/dist/pwa"
12:26:55 AM:  Build summary for css/js/json (the rest are omitted):
12:26:55 AM:  ╔═════════════════════╤═══════════╤═══════════╗
12:26:55 AM:  ║               Asset │      Size │   Gzipped ║
12:26:55 AM:  ╟─────────────────────┼───────────┼───────────╢
12:26:55 AM:  ║      2.4f1f129d.css │   0.92 KB │   0.43 KB ║
12:26:55 AM:  ║    app.82320e00.css │   8.57 KB │   3.06 KB ║
12:26:55 AM:  ║ vendor.da89d61a.css │ 220.64 KB │  37.78 KB ║
12:26:55 AM:  ╟─────────────────────┼───────────┼───────────╢
12:26:55 AM:  ║       2.82bacaa6.js │  23.40 KB │   8.04 KB ║
12:26:55 AM:  ║       3.d2ff6044.js │   0.75 KB │   0.48 KB ║
12:26:55 AM:  ║     app.8c3750c9.js │ 430.07 KB │ 112.82 KB ║
12:26:55 AM:  ║  vendor.c1bb041e.js │ 932.32 KB │ 269.53 KB ║
12:26:55 AM:  ║   service-worker.js │ 148.27 KB │  37.51 KB ║
12:26:55 AM:  ╟─────────────────────┼───────────┼───────────╢
12:26:55 AM:  ║       manifest.json │   0.55 KB │   0.25 KB ║
12:26:55 AM:  ╚═════════════════════╧═══════════╧═══════════╝
12:26:55 AM:  Build succeeded
12:26:55 AM:  Build mode........ pwa
12:26:55 AM:  Pkg quasar........ v1.15.0
12:26:55 AM:  Pkg @quasar/app... v2.1.14
12:26:55 AM:  Debugging......... no
12:26:55 AM:  Publishing........ no
12:26:55 AM:  Transpiled JS..... yes (Babel)
12:26:55 AM:  ==================
12:26:55 AM:  Output folder..... /opt/build/repo/dist/pwa
12:26:55 AM:  Tip: Built files are meant to be served over an HTTP server
12:26:55 AM:       Opening index.html over file:// won't work
12:26:55 AM:  Tip: You can use "$ quasar serve" command to create a web server,
12:26:55 AM:       both for testing or production. Type "$ quasar serve -h" for
12:26:55 AM:       parameters. Also, an npm script (usually named "start") can
12:26:55 AM:       be added for deployment environments.
12:26:55 AM:       If you're using Vue Router "history" mode, don't forget to
12:26:55 AM:       specify the "--history" parameter: "$ quasar serve --history"
12:26:55 AM: Done in 28.63s.
12:26:55 AM: ​
12:26:55 AM: (build.command completed in 28.8s)
12:26:55 AM: ​
12:26:55 AM: ────────────────────────────────────────────────────────────────
12:26:55 AM:   3. Functions bundling                                         
12:26:55 AM: ────────────────────────────────────────────────────────────────
12:26:55 AM: ​
12:26:55 AM: Packaging Functions from src/functions directory:
12:26:55 AM:  - access-token-linkedin.js
12:26:55 AM:  - chat-accept-offer.ts
12:26:55 AM:  - chat-access-token.js
12:26:55 AM:  - chat-cancel-offer.ts
12:26:55 AM:  - chat-create-conversation.js
12:26:55 AM:  - chat-make-offer.ts
12:26:55 AM:  - email-verification-finish.js
12:26:55 AM:  - email-verification-request.ts
12:26:55 AM:  - graphql.js
12:26:55 AM:  - linkedin-upload-resume.js
12:26:55 AM:  - login.js
12:26:55 AM:  - logout.js
12:26:55 AM:  - media-upload-url.ts
12:26:55 AM:  - oauth-facebook.js
12:26:55 AM:  - oauth-google.js
12:26:55 AM:  - order-cancel.js
12:26:55 AM:  - order-fulfill.js
12:26:55 AM:  - pn-notify-register.js
12:26:55 AM:  - reset-password-finish.js
12:26:55 AM:  - reset-password-request.ts
12:26:55 AM:  - search-images.js
12:26:55 AM:  - service-review-create.js
12:26:55 AM:  - signup.js
12:26:55 AM:  - social-post-like.js
12:26:55 AM:  - social-post-save.js
12:26:55 AM:  - social-post-track-view.js
12:26:55 AM:  - version-check.js
12:26:55 AM:  - voucher-verify.ts
12:26:55 AM: ​
12:27:04 AM:  > src/functions/email-verification-request.ts:6:16: error: Could not resolve "aws-sdk" (mark it as external to exclude it from the bundle)
12:27:04 AM:     6 │ import AWS from 'aws-sdk';
12:27:04 AM:       ╵                 ~~~~~~~~~
12:27:04 AM: ​
12:27:04 AM: ────────────────────────────────────────────────────────────────
12:27:04 AM:   Dependencies installation error                               
12:27:04 AM: ────────────────────────────────────────────────────────────────
12:27:04 AM: ​
12:27:04 AM:   Error message
12:27:04 AM:   A Netlify Function failed to require one of its dependencies.
12:27:04 AM:   Please make sure it is present in the site's top-level "package.json".​
12:27:04 AM:   Build failed with 1 error:
12:27:04 AM:   src/functions/email-verification-request.ts:6:16: error: Could not resolve "aws-sdk" (mark it as external to exclude it from the bundle)
12:27:04 AM: ​
12:27:04 AM:   Resolved config
12:27:04 AM:   build:
12:27:04 AM:     command: yarn build && cp _redirects dist/pwa
12:27:04 AM:     commandOrigin: config
12:27:04 AM:     environment:
12:27:04 AM:       - ALGOLIA_APP_ID
12:27:04 AM:       - ALGOLIA_SEARCHER_API_KEY
12:27:04 AM:       - AMPLITUDE_API_KEY
12:27:04 AM:       - AMPLITUDE_ENABLED
12:27:04 AM:       - AWS_S3_BUCKET
12:27:04 AM:       - AWS_S3_VIDEO_BUCKET
12:27:04 AM:       - AWS_SNS_USER_NOTIFICATION_TOPIC_ARN
12:27:04 AM:       - AWS_URL
12:27:04 AM:       - AWS_VIDEO_URL
12:27:04 AM:       - COLLAB_ACCESS_AWS_KEY_ID
12:27:04 AM:       - COLLAB_AWS_REGION
12:27:04 AM:       - COLLAB_AWS_SECRET_ACCESS_KEY
12:27:04 AM:       - FACEBOOK_OAUTH_CLIENT_ID
12:27:04 AM:       - FACEBOOK_OAUTH_SECRET
12:27:04 AM:       - FDB_SERVER_KEY
12:27:04 AM:       - FIREBASE_API_KEY
12:27:04 AM:       - FIREBASE_APP_ID
12:27:04 AM:       - FIREBASE_MESSAGING_SENDER_ID
12:27:04 AM:       - FIREBASE_PROJECT_ID
12:27:04 AM:       - FIREBASE_VAPID_KEY
12:27:04 AM:       - GOOGLE_OAUTH_CLIENT_ID
12:27:04 AM:       - GOOGLE_OAUTH_SECRET
12:27:04 AM:       - GRAPHQL_READER_AUTH
12:27:04 AM:       - GRAPHQL_URI
12:27:04 AM:       - NODE_ENV
12:27:04 AM:       - PEXELS_API_KEY
12:27:04 AM:       - TWILIO_ACCOUNT_SID
12:27:04 AM:       - TWILIO_API_KEY
12:27:04 AM:       - TWILIO_API_SECRET
12:27:04 AM:       - TWILIO_AUTH_TOKEN
12:27:04 AM:       - TWILIO_CHAT_SERVICE_SID
12:27:04 AM:       - TWILIO_NOTIFY_SERVICE_SID
12:27:04 AM:       - TWILIO_PUSH_CREDENTIAL_SID
12:27:04 AM:     publish: /opt/build/repo/dist/pwa
12:27:04 AM:   functionsDirectory: /opt/build/repo/src/functions
12:27:04 AM:   headers:
12:27:11 AM:     - for: /*      values:        X-Frame-Options: DENY  plugins:    - inputs: {}      origin: config      package: netlify-plugin-inline-functions-env  redirects:    - from: /graphql      headers:        Authorization: ****      status: 200      to: https://graphql.fauna.com/graphql    - from: /api/geoip      status: 200      to: https://get.geojs.io/v1/ip/geo.json    - from: /api/actions/create-chat-channel      status: 200      to: /.netlify/functions/chat-create-conversation    - from: /api/actions/*      status: 200      to: /.netlify/functions/:splat    - from: /*      status: 200      to: /index.htmlCaching artifacts
12:27:11 AM: Started saving node modules
12:27:11 AM: Finished saving node modules
12:27:11 AM: Started saving build plugins
12:27:11 AM: Finished saving build plugins
12:27:11 AM: Started saving yarn cache
12:27:11 AM: Finished saving yarn cache
12:27:11 AM: Started saving pip cache
12:27:11 AM: Finished saving pip cache
12:27:11 AM: Started saving emacs cask dependencies
12:27:11 AM: Finished saving emacs cask dependencies
12:27:11 AM: Started saving maven dependencies
12:27:11 AM: Finished saving maven dependencies
12:27:11 AM: Started saving boot dependencies
12:27:11 AM: Finished saving boot dependencies
12:27:11 AM: Started saving rust rustup cache
12:27:11 AM: Finished saving rust rustup cache
12:27:11 AM: Started saving go dependencies
12:27:11 AM: Finished saving go dependencies
12:27:11 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:27:11 AM: Creating deploy upload records
12:27:11 AM: Failing build: Failed to build site
12:27:11 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
12:27:11 AM: Finished processing build request in 1m58.831170146s

Any help would be greatly appreciated, thanks!

Nvm solved it. For those who have run into the same problems, the solution is to add external_node_modules into the netlify config file e.g.

[functions]
  external_node_modules = ["aws-sdk"]

Not sure why this isn’t part of the default when netlify bundles TS modules, might be because I’m using plugins.

1 Like

Hey there, @collabiersid :wave:

Thank you so much for coming back and sharing your solution. It will be beneficial for any future Forums members who encounter something similar. :netliconfetti: