Garret Harp
10/07/2021, 6:09 PMthdxr
10/07/2021, 6:10 PMthdxr
10/07/2021, 6:10 PMsst.Script construct to create / delete the algolia index using the Algolia APIGarret Harp
10/07/2021, 6:12 PMthdxr
10/07/2021, 6:13 PMsst startGarret Harp
10/07/2021, 6:13 PMAdrián Mouly
10/07/2021, 6:14 PMAdrián Mouly
10/07/2021, 6:14 PMGarret Harp
10/07/2021, 6:15 PMAdrián Mouly
10/07/2021, 6:15 PMRoss Coundon
10/07/2021, 6:20 PMenableLiveDev: false for the functionthdxr
10/07/2021, 7:17 PMAdrián Mouly
10/07/2021, 7:17 PMthdxr
10/07/2021, 7:18 PMGarret Harp
10/07/2021, 7:20 PMFrank
Script construct is a perfect fit for your use case. I’m making some changes to the Script construct to make it more “powerful”. If you decide to use it, let me know how it’d look like. And I can make sure the Script construct has everything u need.Frank
sst.Function to Script, you’d have to make sure enableLiveDev is disabled. If you were to define the function inline, that’s automatically done for u.Ross Coundon
10/07/2021, 9:10 PMthdxr
10/07/2021, 9:13 PMRoss Coundon
10/07/2021, 9:16 PMFrank
Script is a custom resource, so the function you provide it will run during CloudFormation deploy. And when you run sst start, the local environment (the websocket connect) starts up AFTER CloudFormation finishes deploying.Frank
enableLiveDev is ON, Script will try to connect to ur local to run the code, but the local environment has started yet, and Script will fail, in turn the while CFN deploy will fail.Frank
Ross Coundon
10/07/2021, 10:21 PMGarret Harp
10/08/2021, 6:48 PMFrank
new sst.Script(this, "MyScript", {
onCreate: "src/script.create",
onUpdate: "src/script.update",
onDelete: "src/script.delete",
});
Does this make sense?Garret Harp
10/08/2021, 6:57 PMFrank
Frank
Script, you can follow this doc to update - https://docs.serverless-stack.com/constructs/Script#upgrading-to-v0460Garret Harp
10/09/2021, 2:37 PM