Paulo
02/12/2021, 8:15 AMJay
Paulo
02/12/2021, 7:36 PMroot
|-- region-a
| |-- sst.json
| |-- package.json (no deps)
|
|-- region-b
| |-- sst.json
| |-- package.json (no deps)
|
|-- package.json (all deps)
running npx sst deploy
from the region folder, I got this
npx: installed 1 in 1.474s
command not found: sst
I moved the @serverless-stack/cli
to the region folder and got this
Preparing your SST app
Transpiling source
> node_modules/@aws-cdk/core/lib/private/runtime-info.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning)
15 │ for (const fileName of Object.keys(require.cache)) {
╵ ~~~~~~~
> node_modules/@aws-cdk/core/lib/private/runtime-info.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning)
64 │ const mod = require.cache[fileName];
╵ ~~~~~~~
> node_modules/@aws-cdk/custom-resources/lib/aws-custom-resource/runtime/index.js: error: Could not read from file: /tmp/node_modules/aws-sdk
76 │ AWS = require('/tmp/node_modules/aws-sdk');
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings and 1 error
There was a problem transpiling the source.
then, I moved @serverless-stack/resources
to the region folder and got this:
Preparing your SST app
Transpiling source
> node_modules/@aws-cdk/core/lib/private/runtime-info.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning)
15 │ for (const fileName of Object.keys(require.cache)) {
╵ ~~~~~~~
> node_modules/@aws-cdk/core/lib/private/runtime-info.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning)
64 │ const mod = require.cache[fileName];
╵ ~~~~~~~
2 warnings
Linting source
Deploying stacks
The deployment seems to work, but with these warnings, so I didn't try anything elseJay
package.json
and ignoring them automatically. But since the package.json
in your sub-dir doesn't have all those dependencies (aws-cdk
), it's not able to ignore them.
A couple of solutions. You can just ignore these warnings for now. Or disable esbuild bundling (https://docs.serverless-stack.com/constructs/Function#bundle) if you get errors instead or warnings.
Or for this setup, use Yarn Workspaces. That way, you can still list all the dependencies in the sub-dir correctly, and Yarn will lift all the dependencies to the root and manage it for you.Jay