Hey everyone. Two simple questions: 1. How to mod...
# sst
i
Hey everyone. Two simple questions: 1. How to modify webpack configuration in SST? We could do this in serverless via
serverless.yml
but I found no info how to do it in SST. 2. In SST I use
serverless-mysql
what I used in
serverless
. Is it ok for SST? I faced an issue when I tried to deploy code to prod:
Error: Received packets in the wrong sequence
I found that we need to disable webpack minimization of modules but I have no idea how to do it in SST Hope someone faced these issues. They are looking common but as this framework is new....There are no info in google.
t
Can you expand more on what you mean by webpack config? SST doesn't use webpack in any way
You can add
serverless-mysql
to
bundle.nodeModules
to disable bundling
i
@thdxr Anyway. What do you mean 'bundle.nodeModules'? In which file should I add this?
nodeModules
array specifies a list of packages that shouldn't be bundled and instead pulled from npm and included in node_modules
i
@thdxr There is one thing. I create functions throuw
new sst.Api()
constructor
t
You can set default bundle options on the api
i
Looking...
@thdxr If I add
Copy code
defaultFunctionProps: {
 bundle: {
  nodeModules: ["serverless-mysql"]
 }
},
and run
npx sst build
I will get an error .sst/artifacts/8548657d/package.json: Unexpected end of JSON input
have you faced this issue?
t
what version of sst are you on?
update to latest
i
Copy code
"@serverless-stack/cli": "0.60.2",
"@serverless-stack/resources": "0.60.2",
@thdxr Off docs says this is the latest (stable) despite on alpha versions
f
@Ivan Roskoshnyi can you try updating them to
Copy code
"@serverless-stack/cli": "0.60.4",
"@serverless-stack/resources": "0.60.4",
and then give it a try?
i
@Frank I tried but there was version mismatch. I also tried to update ``aws-cdk-lib`` to the suggested version ( using npx in the terminal) but I god npm error
package doesn't exist in npm registry
So I solved my issue. with
minimize: false
nodeModules
prop doesn't work for me
g
Hi, I'm facing the same issue, how did you solve it?
t
Which issue @Gita Alekhya Paul
g
I was facing the
Unexpected end of JSON input
issue on
0.60.2
but it got resolved on version
0.60.8
f
@Ivan Roskoshnyi can you updating
aws-cdk-lib
to “2.7.0”? ie.
Copy code
"@serverless-stack/cli": "0.60.11",
"@serverless-stack/resources": "0.60.11",
"aws-cdk-lib": "2.7.0",
i
@Frank Couldn't install 0.60.9
Copy code
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <<https://npm.community>>

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ivan/.npm/_logs/2022-02-02T19_17_45_977Z-debug.log
trying to install 0.60.11
@Frank Unfortunately it didn't help. Artifacts were not created at all. What the reason could be?
f
@Ivan Arteaga sorry for the late follow up. Did you manage to get update to work?