colin
07/25/2021, 4:48 PMRuntime.ImportModuleError: Error: Cannot find module 'ts-tiny-invariant'
Require stack:
- /var/task/server.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
at _loadUserApp (/var/runtime/UserFunction.js:100:13)
at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)
at Object.<anonymous> (/var/runtime/index.js:43:30)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
Frank
sst start
and see if the apollo api works?Phil Astle
07/26/2021, 8:14 AMcolin
07/26/2021, 2:35 PMsst deploy
to a different stage @Frank. When I run sst start
things seem to be working fine..colin
07/26/2021, 2:35 PMcolin
07/26/2021, 2:59 PMsst start
this error goes away. After a successful query I tried to run sst deploy
and I got the same error. The module seems to be some kind of typescript dependency. So maybe something is off in the sst deploy/build step?
Didn’t notice anything too weird in the build logsPhil Astle
07/26/2021, 3:32 PMPhil Astle
07/26/2021, 3:32 PMcolin
07/26/2021, 3:33 PMcolin
07/26/2021, 3:33 PMFrank
@graphql-tools
modules in ur dependencies?colin
07/26/2021, 8:00 PMapollo-server-core
colin
07/26/2021, 8:00 PMFrank
Frank
bundle
option?
bundle: {
nodeModules: ["apollo-server-core"],
}
colin
07/26/2021, 11:46 PMFrank
ts-tiny-invariant
is being required dynamically. When packaging the code, esbuild traverse through all requires/imports to include the relevant code that are used, instead of including the entire node_modules
folder. But if modules are included dynamically/conditionally at runtime, esbuild will ignore them.Frank
nodeModules
, SST will package the entire apollo-server-core
package including all of its node_modules
, which should include the ts-tiny-invariant
package.Frank
colin
08/02/2021, 4:50 PMFrank