Having some issues with SST using multiple `aws-cd...
# help
r
Having some issues with SST using multiple
aws-cdk-lib
versions. Is there a reason this is needed? I'll add more details in the thread.
So what is happening is I import
import { Certificate } from 'aws-cdk-lib/aws-certificatemanager'
which will be the 2.25 CDK version
However the
customDomain
property of
ViteStaticSite
(and others) will pull from
@serverless-stack/resources/node_modules/aws-cdk-lib/aws-certificatemanager
(2.24)
This causes a typescript error of
Types have separate declarations of a private property 'amount'.
Which is absolutely stupid... but here we are. It is upset that both the
Duration
in my
node_modules
and the
Duration
in the
sst/resources/node_modules
both define a
private readonly amount
even though the files are the same 😕
My quick hack workaround is just to import the cert manager right from the resources node modules instead of the "top level" one.
Copy code
import {
  Certificate,
} from '@serverless-stack/resources/node_modules/aws-cdk-lib/aws-certificatemanager'
t
I'll look into this, this doesn't seem intentional
what package manager are you using?
I have no idea how this happened for you
mine has all 2.24.0
r
maybe this is a
package-lock
situation? not sure how it would have gotten in there.. lemme see
Alright 2.25.0 is in my
package-lock
so is 2.24.0. lemme trash this file, and
node_modules
for my project/workspaces and try again
t
Yeah you should add it yourself
The fact that it works isn't actually in the module spec so future package managers may break this
(some already do)
Btw the reason this happened is NPM is a psycho
r
Yeah? do i also pin the version? will
npx sst update
also update my copy as well or do i need to update manuallty also?
t
It'll update your copy and yeah pin don't use ^
r
oh no i absolute understand npm is insane. Throw in esm and cjs and it just a hot mess, but its the hot mess we got 🙂
t
one day in the distant future we'll look back on this and be like "remember how terrible everything was"
r
I sure hope so, though sadly i fear this is a echo of a circa 2009 PHP developer when nodeJS came out 🙂 I guess technically they weren't wrong, just a bit more future then they expected