sst: Dependencies Not Resolving in SST v3.9.10
Description
I am experiencing issues with resolving dependencies in my SST application. The error message is straightforward:
Could not resolve "sst" (or any other package) when calling a lambda function. It works fine w/o any import.
I found a related issue: #4414 (sadly, w/o solution) and tested my setup using the suggested monorepo-template boilerplate. However, I am still encountering the same problem. I tried sst dev which lead to the same error when calling the lambda function. sst deploy will drop the same issue while deploying.
I have tried using both PNPM (preferred) and NPM, but dependencies remain unresolved. On my private repository, I’m using a bunch of other resources such as UserPools, UserGroups, Cluster, VPN, RDS, DynamoDB, etc. without any issues.
Steps to Reproduce
git clone https://github.com/sst/monorepo-templatenvm use 22.13.1pnpm installsst dev- Call the given lambda url
Expected Behavior
Dependencies should be properly resolved without errors.
Environment
- OS: macOS 14.0 (M1)
- Node.js Version: 22.13.1
- PNPM Version: 8.10.0 and 10.4.1
- NPM Version: 10.9.2
- SST Version: 3.9.10 (tested various 3.9.x versions)
Additional Context
- I have tested this with both the standard SST setup and the mono-repository boilerplate.
- The issue persists across different package managers.
Any guidance on resolving this would be appreciated. Thanks!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (3 by maintainers)
I think I finally figured out what was causing the issue 🎉
For some reason, I had
.pnp.cjsand.pnp.loader.mjsfiles in my home directory (no idea when or how they got there).After deleting them, both my test project (which uses
yarn) and theaws-apiexample (which usesnpm) started working.Hope this helps if anyone else is running into this and losing their mind over it!
I’ve been running into this same issue for a few days now — I’m unable to use any dependencies. Whatever I try to add results in an error.
This is just a basic test project using Yarn 4.9.1 with the following setup:
For reference, I’m also including my
package.jsonbelow:I also don’t think the solution should be to add things like
nodejs: { install: ["whatever"] }inside each function definition.This part used to work much more smoothly in SST v2.
Adding packages manually worked for me. It doesn’t work right away after deployment, give it 2-3 minutes before testing.