Dan Van Brunt
10/11/2021, 7:33 PMlambda.SingletonFunction
which makes a ton of sense if you are building a construct that could be used a number of times in the same stack…. you would not want it to reimplement the CR function as many times.
However, I’d like to be able to use the same asset compression for functions that sst.Function
gives you.
Am I missing something, is there an easy way to have my cake and eat it too?thdxr
10/11/2021, 7:34 PMsst.Script
?Dan Van Brunt
10/11/2021, 7:37 PMDan Van Brunt
10/11/2021, 7:38 PMthdxr
10/11/2021, 7:38 PMsst.Script
is built on top of CustomResource. You can pass in handlers for CUDDan Van Brunt
10/11/2021, 7:39 PMthdxr
10/11/2021, 7:40 PMDan Van Brunt
10/11/2021, 7:40 PMsst.Script
and not *sst*.CustomResource
or cdk.CustomResource
Dan Van Brunt
10/11/2021, 7:40 PMDan Van Brunt
10/11/2021, 7:40 PMthdxr
10/11/2021, 7:42 PMsst.Queue
where we just provide a nicer layer on top of the raw cdk ConstructDan Van Brunt
10/11/2021, 7:43 PMCustomResource
? Like you did with Bucket
or App
?thdxr
10/11/2021, 7:44 PMDan Van Brunt
10/11/2021, 7:46 PMlambda.Singleton
feature, which I’m not even sure how it works but it seems to make sense for a utils CR that you would not want/need to be replicated multiple times.thdxr
10/11/2021, 7:48 PMDan Van Brunt
10/11/2021, 8:02 PMDan Van Brunt
10/11/2021, 8:03 PMIf you are configuring theBut if you implement as onCreate, onUpdate, etc… then it ONLY runs on those, and NOT every deploy, yes?like below,function
gets run both when thefunction
is creating, and each time the SST app is deployed.Script
thdxr
10/11/2021, 8:03 PMthdxr
10/11/2021, 8:04 PMDan Van Brunt
10/11/2021, 8:17 PMDan Van Brunt
10/11/2021, 8:39 PMsst.Function
Dan Van Brunt
10/11/2021, 8:40 PMDan Van Brunt
10/12/2021, 3:03 AMsst.Function
for the function and getting what I think is a building issue when it executes…
Received response status [FAILED] from custom resource. Message returned: Upe is not a function
With each deploy that Upe
is a different set of 3 numbers.
I wonder if this has to do with how the function is bundled, assuming the core provider is trying to wrap the function to handle deployment errors (replying to CFN)? Not sure how to debug this.Dan Van Brunt
10/12/2021, 1:15 PMthdxr
10/12/2021, 1:16 PMthdxr
10/12/2021, 1:16 PMsst build
succeed?Dan Van Brunt
10/12/2021, 1:16 PMDan Van Brunt
10/12/2021, 1:16 PMthdxr
10/12/2021, 1:17 PMUpe
?Dan Van Brunt
10/12/2021, 1:18 PMcr.Provider
is trying to “wrap” the function that is minified and thus trying to run the minified function name?Dan Van Brunt
10/12/2021, 1:18 PMDan Van Brunt
10/12/2021, 1:19 PMDan Van Brunt
10/12/2021, 1:20 PMthdxr
10/12/2021, 1:21 PMUpe is not a function
isn't coming from your lambda code? Seems like a js errorDan Van Brunt
10/12/2021, 1:28 PMUpe
isn’t a function of mine and those three letters change each time I make a change and rebuildthdxr
10/12/2021, 1:34 PMDan Van Brunt
10/12/2021, 2:42 PMthdxr
10/12/2021, 2:43 PMDan Van Brunt
10/12/2021, 3:00 PMthdxr
10/12/2021, 3:02 PMDan Van Brunt
10/12/2021, 3:14 PMFrank
Script
was originally created primarily for the purpose of seeding DB and running DB cleanup scripts, etc, hence the name.Frank
Received response status [FAILED] from custom resource. Message returned: Upe is not a function
on deploy and CFN reports this error?Dan Van Brunt
10/12/2021, 7:14 PMUpe is not a function
in the function logsDan Van Brunt
10/12/2021, 7:15 PM--no-rollback
does that flag work with sst cli?thdxr
10/12/2021, 8:05 PMFrank
enableLiveDev
to false in ur Function when used in custom resource.
const onEventFunction = new Function(this, 'resource-lambda', {
handler: 'src/lambda.onEvent',
memorySize: 512,
timeout: cdk.Duration.minutes(5),
enableLiveDev: false,
})
Frank
Upe
in your code 🤔thdxr
10/12/2021, 8:14 PMthdxr
10/12/2021, 8:14 PMFrank
enableLiveDev
and assigning a random string (so onUpdate
gets called on every deploy) are the things the Script
construct does out of the box 🤓Dan Van Brunt
10/12/2021, 8:38 PMDan Van Brunt
10/12/2021, 8:55 PMthdxr
10/12/2021, 8:55 PMthdxr
10/12/2021, 8:55 PMthdxr
10/12/2021, 8:56 PMDan Van Brunt
10/12/2021, 8:56 PMthdxr
10/12/2021, 8:56 PMDan Van Brunt
10/12/2021, 9:40 PMsst build
and then cdk deploy --no-rollback
?thdxr
10/12/2021, 9:42 PMDan Van Brunt
10/12/2021, 9:48 PMDan Van Brunt
10/12/2021, 9:50 PMPlease check if you have installed “@aws-sdk/signature-v4-crt” package explicitly.
For more information please go to https://github.com/aws/aws-sdk-js-v3#known-issues``The AWS SDK for JavaScript (v3) will
no longer support Node.js ${e} as of January 1, 2022.
To continue receiving updates to AWS services, bug fixes, and security
updates please upgrade to Node.js 12.x or later.
More information can be found at: https://a.co/1l6FLnu`,“NodeDeprecationWarning
Dan Van Brunt
10/12/2021, 9:52 PMDan Van Brunt
10/12/2021, 10:02 PMReceived response status [FAILED] from custom resource. Message returned: Ipe is not a function
Dan Van Brunt
10/12/2021, 10:03 PMthdxr
10/12/2021, 10:05 PMthdxr
10/12/2021, 10:05 PMDan Van Brunt
10/12/2021, 10:06 PMthdxr
10/12/2021, 10:07 PMDan Van Brunt
10/12/2021, 10:07 PMDan Van Brunt
10/12/2021, 10:07 PMDan Van Brunt
10/12/2021, 10:08 PMvar Ipe=Ss(BO()),qO=Ipe("logger:logs");
its the instantiation for my logger ``logger:logs``Dan Van Brunt
10/12/2021, 10:09 PMimport * as debug from 'debug'
const logger = debug('logger:logs')
// eslint-disable-next-line no-undef
logger.log = console.log.bind(console)
export default logger
Dan Van Brunt
10/12/2021, 10:09 PMDan Van Brunt
10/12/2021, 10:10 PMDan Van Brunt
10/12/2021, 10:10 PMdebug
isnt in my package.jsonDan Van Brunt
10/12/2021, 10:11 PMthdxr
10/12/2021, 10:15 PMthdxr
10/12/2021, 10:15 PMDan Van Brunt
10/12/2021, 10:17 PMDan Van Brunt
10/12/2021, 10:18 PMthdxr
10/12/2021, 10:18 PMthdxr
10/12/2021, 10:18 PMthdxr
10/12/2021, 10:19 PMDan Van Brunt
10/12/2021, 10:19 PMthdxr
10/12/2021, 10:41 PMthdxr
10/12/2021, 10:41 PMbundle.minify: false
option on the functionthdxr
10/12/2021, 10:41 PMsst start
will do --rollback=false
by default and you can do sst deploy --rollback=false
Dan Van Brunt
10/13/2021, 12:57 AMyarn add blah@0.46.0-next.16
thdxr
10/13/2021, 12:57 AMDan Van Brunt
10/13/2021, 2:28 AM0.46.0-next.16
for both CLI and resources but still getting rollbacks after yarn deploy --rollback=false
thdxr
10/13/2021, 2:32 AMthdxr
10/13/2021, 2:32 AM--no-rollback
I might not have remembered to flip the flag backthdxr
10/13/2021, 2:33 AMDan Van Brunt
10/13/2021, 2:34 AM--no-rollback
?thdxr
10/13/2021, 2:35 AM--rollback=true/false
and they support --no-rollback
as an extra option. Reason we're going with --rollback
is because we want to default it to false on sst start
and people will need a way to turn that onthdxr
10/13/2021, 2:35 AMDan Van Brunt
10/13/2021, 2:36 AMDan Van Brunt
10/13/2021, 2:36 AMDan Van Brunt
10/13/2021, 2:37 AMthdxr
10/13/2021, 2:40 AMDan Van Brunt
10/13/2021, 2:44 AMUPDATE_ROLLBACK_COMPLETE
so that means its not working for me right?Dan Van Brunt
10/13/2021, 2:44 AMthdxr
10/13/2021, 2:45 AMthdxr
10/13/2021, 2:45 AMthdxr
10/13/2021, 3:01 AMsst deploy --help
thdxr
10/13/2021, 3:02 AMDan Van Brunt
10/13/2021, 3:20 AMthdxr
10/13/2021, 3:22 AM--rollback=false
should workthdxr
10/13/2021, 3:23 AMthdxr
10/13/2021, 3:30 AMDan Van Brunt
10/13/2021, 4:19 AM