Hi everyone. I am trying to update sst from versio...
# help
m
Hi everyone. I am trying to update sst from version
0.69.7
to
1.1.1
I changed my stack for a functional stack and managed to make it deploy properly. However, although I installed
vitest
and tried to fix my tests it seems I’m doing something wrong since I keep getting an error when I run
npm test
The error is located in this line:
const goLambda = new lambda.Function(stack, 'triggerRawToProcessJobGo', {
environment,
runtime: lambda.Runtime.GO_1_X,
handler: 'ingestion',
layers: [appConfigLayer],
code: lambda.Code.fromAsset('src/backend/mainmodule',
....
}),
});
it says this:
Error: Failed to bundle asset dev-my-app/triggerRawToProcessJobGo/Code/Stage, bundle output is located at /private/var/folders/jf/4x6j7wjd7vv57m6q_n0458b00000gn/T/cdk.out2KAJkC/asset.15f36b77f48997c8703e2300c8a640d5fdb2eddc95f4eb4607c00b74a8bc8053-error: TypeError [ERR_INVALID_OPT_VALUE]: The value "WritableWorkerStdio {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,..." is invalid for option "stdio"
It looks to me that it might be related to a
path
issue in the
code
property. Some difference between the test framework and the normal deployment. But it was working as is before the upgrade so I’m having issues solving it. Thanks for any help!
t
Were you using jest before?
m
Yes I was
t
As a quick fix you can install jest and continue to use it. I'm not sure what this error is coming from deep cdk
m
yes, I was thinking on doing that momentarily. I tried to move to vitest because I saw the updated sst creation module changed to vitest. Thanks!
t
SST build works fine?
m
it does indeed. I wonder if it is related to the
srcPath
property that I set to the
app
But I have tried different values and no luck so far
t
lambda.Function is a direct CDK construct so nothing SST related should effect it
curious why you're using that instead of sst.Function
m
I have no good answer for that. I thought I looked to see if it was wrapped by sst and it wasn’t. But checking again I see it’s there so… I might as well try that 😄
hey @thdxr just to let you know that I changed the functions to sst and my test is still failing. However it is failing in a
python
lambda now. again it works fine on deployment. The error is the same:
TypeError: The value "WritableWorkerStdio {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,..." is invalid for option "stdio"
I could track it up to this line of code in
pythonBundling.js
:
const image = cdk.DockerImage.fromBuild(stagedir, {
buildArgs: {
IMAGE: runtime.bundlingImage.image,
},
file: dockerfile,
});
and this is my python lambda stack code:
const pyLambda = new sst.Function(stack, 'triggerRawToProcessJobPython', {
environment,
runtime: "python3.9",
handler: 'internal.core.ingestion.ingestion.lambda_handler',
layers: [appConfigLayer],
srcPath: 'src/backend/mainmodule'
});
trying to have it working with Jest but I get the error : “Unknown script “test”.”
f
@Miguel do you have
jest
setup in ur `package.json`’s scripts? ie.
Copy code
"scripts": {
  "test": "jest"
}
m
Nice, that works. I had :
"scripts": {
"test": "sst test"}
Thank you!
What I’m missing now with functional stacks is a way of retreiving the stack from my test to do something like:
Template.fromStack(stack)
I’m reading the docs but can’t find it
nevermind, I figured it out. returning the whole stack from the function and then using
use(Stack)
👍