SST Guide Forums - Latest posts https://discourse.sst.dev Latest posts SST is not defined WSL This is something that I think is pretty confusing about the sst docs. The docs make it seem like this is a valid sst.config.ts file:

But as far as I can tell what that is really saying is that it’s a snippit inside the run() {} function of your sst.config.ts file which looks more like this: Config | SST

I imagine that’s what you were running into. At least that was the issue for me when I hit that error.

]]>
https://discourse.sst.dev/t/sst-is-not-defined-wsl/3053#post_2 Mon, 12 Jan 2026 04:32:23 +0000 discourse.sst.dev-post-8374
Secure Our Serverless APIs I”m getting the same result.

]]>
https://discourse.sst.dev/t/secure-our-serverless-apis/2467#post_13 Tue, 26 Aug 2025 11:26:59 +0000 discourse.sst.dev-post-8362
Adding Auth to Our Serverless App Yeah. I had the same question.

]]>
https://discourse.sst.dev/t/adding-auth-to-our-serverless-app/2457#post_13 Tue, 26 Aug 2025 11:05:19 +0000 discourse.sst.dev-post-8361
Next.js api route streaming data I added “X-Accel-Buffering”: “no” to the headers and it worked for me. I believe this disables cloudfront from buffering.

]]>
https://discourse.sst.dev/t/next-js-api-route-streaming-data/2979#post_2 Wed, 30 Jul 2025 08:01:49 +0000 discourse.sst.dev-post-8351
Add an API to Create a Note Oh nvm. I figured it out. its the name in package.json :slight_smile:

]]>
https://discourse.sst.dev/t/add-an-api-to-create-a-note/2451?page=2#post_29 Mon, 21 Jul 2025 11:42:24 +0000 discourse.sst.dev-post-8349
Add an API to Create a Note What is it that makes this line of code work?

import { Util } from "@notes/core/util";

Specifically, where does @notes/* get defined?

]]>
https://discourse.sst.dev/t/add-an-api-to-create-a-note/2451?page=2#post_28 Mon, 21 Jul 2025 11:36:53 +0000 discourse.sst.dev-post-8348
SST not preserving state after switching AWS credentials Hi,

I recently switched my AWS CLI credentials to my personal account and then switched back to my work account. However, when I run sst dev, it seems to recreate all the resources instead of using the existing ones. It also doesn’t preserve the state of my previously deployed stage.

Is there a way to make SST use the existing deployed stack and avoid recreating everything? Would appreciate any help on this!

Thanks!

]]>
https://discourse.sst.dev/t/sst-not-preserving-state-after-switching-aws-credentials/3064#post_1 Wed, 09 Jul 2025 04:14:24 +0000 discourse.sst.dev-post-8343
New to SST & IaC — How to Link Existing RDS & Connect via pgAdmin (with Bastion) Hi everyone,
I’m fairly new to Infrastructure as Code (IaC) and currently exploring SST (Serverless Stack).

I have two questions:


1. How can I link SST to an existing RDS instance (created via the AWS Console)?

I’m using the following setup:

sst.config.ts:

/// <reference path="./.sst/platform/config.d.ts" />

export default $config({
  app(input) {
    return {
      name: "my-app",
      removal: input?.stage === "production" ? "retain" : "remove",
      protect: ["production"].includes(input?.stage),
      home: "aws"
    };
  },

  async run() {
    const db = aws.rds.Instance.get("name", "existing-db-id");

    // Attempting to import an existing VPC
    const vpc = new aws.ec2.Vpc("importedVpc", {}, {
      import: "vpc-xxxxx"
    });

    const api = new sst.aws.ApiGatewayV2("MyAPI", {
      vpc: {
        securityGroups: ["sg-xxxxx"],
        subnets: ["subnet-xxxxx", "subnet-xxxxx"]
      },
      transform: {
        route: {
          args: { auth: { iam: false } }
        }
      }
    });

    api.route("GET /test", {
      link: [db],
      handler: "path/to/handler"
    });
  }
});

handler.js:

import { pool } from "./postgres.js";

export async function handler() {
  try {
    const res = await pool.query("SELECT NOW() as current_time");
    return {
      statusCode: 200,
      body: JSON.stringify({
        message: "Test successfully!",
        dbTime: res.rows[0].current_time
      })
    };
  } catch (err) {
    console.error("DB Error:", err);
    return {
      statusCode: 500,
      body: JSON.stringify({ error: "Database connection failed." })
    };
  }
}

postgres.js:

import { Pool } from "pg";

export const pool = new Pool({
  host: "hardcoded", // <-- How can I dynamically link this?
  port: 5432,
  user: "hardcoded",
  password: "hardcoded",
  database: "hardcoded",
  max: 5,
  idleTimeoutMillis: 30000,
  connectionTimeoutMillis: 2000,
  ssl: false
});

If I create the database via SST, I can use Resources.Db.endpoint — but what’s the best way to handle this when using aws.rds.Instance.get()?


2. How can I connect to the RDS instance (created via SST) using pgAdmin through a Bastion host?

I’ve also tried creating both the RDS and Bastion host via SST and it works — the Lambda function can access the RDS — but I’m not sure how to tunnel through the Bastion to connect using pgAdmin from my local machine.


Feel free to suggest improvements, better practices, or even alternative IaC tools.
Thanks in advance! :folded_hands:

]]>
https://discourse.sst.dev/t/new-to-sst-iac-how-to-link-existing-rds-connect-via-pgadmin-with-bastion/3061#post_1 Tue, 01 Jul 2025 07:05:59 +0000 discourse.sst.dev-post-8336
SST is not defined WSL I am following tutorial Next.js on AWS with SST | SST
under WSL on windows, I made it work once, but after I pulled my project and tried to make it work again with npx sst dev, I see an error ReferenceError: sst is not defined although SST is installed and project is initialized with npx sst@latest init.
I tried creating project from scratch following the tutorial, wiping cached data in the subsystem, but I still keep getting this error

time=2025-05-23T19:23:48.210+02:00 level=INFO msg="checking for pulumi" path=/home/user1/.config/sst/bin/pulumi
time=2025-05-23T19:23:48.850+02:00 level=INFO msg="checking for bun" path=/home/user1/.config/sst/bin/bun
time=2025-05-23T19:23:48.857+02:00 level=INFO msg="initializing project" version=3.16.0
time=2025-05-23T19:23:48.858+02:00 level=INFO msg="esbuild building" out=/home/user1/aws-nextjs/.sst/platform/sst.config.1748021028858.mjs
time=2025-05-23T19:23:48.870+02:00 level=INFO msg="esbuild built" outfile=/home/user1/aws-nextjs/.sst/platform/sst.config.1748021028858.mjs
time=2025-05-23T19:23:48.871+02:00 level=INFO msg="evaluating config"
time=2025-05-23T19:23:49.009+02:00 level=INFO msg="config evaluated"
time=2025-05-23T19:23:49.009+02:00 level=ERROR msg="exited with error" err="Error evaluating config: exit status 1\nfile:///home/user1/aws-nextjs/.sst/platform/sst.config.1748021028858.mjs:13\nvar bucket = new sst.aws.Bucket(\"MyBucket1\", {\n             ^\n\nReferenceError: sst is not defined\n    at file:///home/user1/aws-nextjs/.sst/platform/sst.config.1748021028858.mjs:13:14\n    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)\n    at async ModuleLoader.import (node:internal/modules/esm/loader:336:24)\n    at async loadESM (node:internal/process/esm_loader:34:7)\n    at async handleMainPromise (node:internal/modules/run_main:106:12)\n\nNode.js v18.19.1\n"
✕  Unexpected error occurred. Please run with --print-logs or check .sst/log/sst.log if available.
]]>
https://discourse.sst.dev/t/sst-is-not-defined-wsl/3053#post_1 Fri, 23 May 2025 17:33:15 +0000 discourse.sst.dev-post-8328
Auth Stack - how to customize cognito password policy Yes, apparently it is different for v2 and v3. For v3:

export const userPool = new sst.aws.CognitoUserPool(
  "UserPool",
  {
    usernames: ["email"],
    verify: {
      emailSubject: "Verify your email for our app",
      emailMessage: "Hello {username}, your verification code is {####}",
    },
    transform: {
      userPool: (args, _opts) => {
        args.passwordPolicy = {
          minimumLength: 10,
          requireUppercase: false,
          requireSymbols: false,
          requireNumbers: false,
          requireLowercase: false,
          temporaryPasswordValidityDays: 7,
        }
      }
   }
}
]]>
https://discourse.sst.dev/t/auth-stack-how-to-customize-cognito-password-policy/2711#post_2 Sat, 10 May 2025 06:09:05 +0000 discourse.sst.dev-post-8323
How to Set Node Version? You need to update sst, equal or higher than 2.47.2. Please keep in mind that if you use setDefaultFunctionProps, it only affects when you run sst deploy, not sst dev

]]>
https://discourse.sst.dev/t/how-to-set-node-version/2900#post_7 Thu, 08 May 2025 10:03:18 +0000 discourse.sst.dev-post-8321
Automating Cleanup We run an AWS development account where engineers are free to deploy v3 SST Stacks. The problem we are facing is that resources created may not be cleaned by the person who deployed the stack, leading to excessive bills for unused resources.

We are able to see the SST state files generated in s3 and infer whether they were created before an arbitrary date (based on the ‘LastModifiedDate’) and should therefore be cleaned up.

In v2, a Cloudwatch stack was created and removing them based on date was trivial. Is there a way in v3 that we can remove the stack without having the original sts.config.js file?

We would prefer not to use the console to perform these actions.

]]>
https://discourse.sst.dev/t/automating-cleanup/3045#post_1 Wed, 07 May 2025 12:02:29 +0000 discourse.sst.dev-post-8318
How to Set Node Version? Did you ever get a solution to this?

I’m facing the same problem but with trying to update from Node 18 to Node 20. Changing the runtime seems to only update the server Lambda. There are ancilliary Lambdas that sst is building that seem to be “hard code” to Node 18.

]]>
https://discourse.sst.dev/t/how-to-set-node-version/2900#post_6 Tue, 06 May 2025 13:51:54 +0000 discourse.sst.dev-post-8316
Test the Billing API Speaking from india, Stripe won’t let me create an account.

They asked to entertain your reason and I said it was for learning and I will use stripe for my upcoming projects but still no luck.

How did you guys made it.

]]>
https://discourse.sst.dev/t/test-the-billing-api/172?page=2#post_28 Thu, 03 Apr 2025 01:38:12 +0000 discourse.sst.dev-post-8313
Balancing Environment-Specific Configurations in SST Deployments Hello

In my current SST project; I’m facing challenges with managing environment-specific configurations across multiple deployment stages (development, staging, production). :innocent: The configurations often differ significantly between environments, which makes it challenging to maintain consistency & avoid misconfigurations that could lead to unexpected behavior in production. I’m curious about strategies or tools within the SST ecosystem that can streamline this process. :innocent:

The main issue arises from having to manually adjust settings for each environment; leading to increased complexity and potential for human error. :upside_down_face: I’m looking for insights on automating environment configuration management, possibly by integrating centralized configuration services / leveraging SST’s built-in features to dynamically manage environment variables.

Detailed examples of how others have achieved a seamless transition between environments would be extremely helpful. :thinking:

I’d appreciate hearing from community members who have tackled similar challenges, including any best practices or tips that have worked well for you. Checked https://v2.sst.dev/configuring-sst-Salesforce Developer Training guide related to this and found it quite informative.

For those new to managing configurations in SST, I recommend checking out the SST Configuration Guide as a starting point. :thinking:This resource offers valuable insights into how SST handles environment-specific settings and can serve as a useful reference for improving your deployment workflows.

Thank you !! :slightly_smiling_face:

]]>
https://discourse.sst.dev/t/balancing-environment-specific-configurations-in-sst-deployments/3040#post_1 Fri, 21 Mar 2025 08:41:08 +0000 discourse.sst.dev-post-8311
How to create a REST API with serverless How to create a REST API with serverless in this chapter when trying to execute getting error saying:

❌  SSTBootstrap failed: Resource handler returned message: "The runtime parameter of nodejs14.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use a supported runtime while creating or updating functions. 

Any solutions available? Tried to set runtime for lambda but not working

]]>
https://discourse.sst.dev/t/how-to-create-a-rest-api-with-serverless/2305#post_2 Wed, 12 Mar 2025 17:12:38 +0000 discourse.sst.dev-post-8310
Unable to install sst on a WLS As sst does not natively support Windows OS, I downloaded a WLS and ran the app on the virtual machine called Ubuntu.
However, I am still unable to install sst:

]]>
https://discourse.sst.dev/t/unable-to-install-sst-on-a-wls/3011#post_1 Tue, 31 Dec 2024 04:48:59 +0000 discourse.sst.dev-post-8281
Getting 503 error results after building with Node 18 Newbie here. We are able to run a lambda manually from the Dev lappy but for some reason building the same code I am getting a 503 error. I am not sure how to trouble shoot this and would appreciate any help. ENV is Mac SST 2 Node 18
node_modules import errors

]]>
https://discourse.sst.dev/t/getting-503-error-results-after-building-with-node-18/3009#post_1 Mon, 30 Dec 2024 20:50:04 +0000 discourse.sst.dev-post-8279
Create a New React.js App I’m seeing this error in vite.config.ts in the frontend folder:

plugins: [react()], is throwing an error under react and hovering over it shows me this:

No overload matches this call.
The last overload gave the following error.
Type ‘PluginOption’ is not assignable to type ‘PluginOption’.

Really at a loss for how to solve this, googling it hasn’t gotten me anywhere

]]>
https://discourse.sst.dev/t/create-a-new-react-js-app/68?page=2#post_32 Sat, 14 Dec 2024 03:47:37 +0000 discourse.sst.dev-post-8276
Sst v3 {"body":"sst dev is not running"} I had the same problem. Just remove timeout for handler, then it should work.

]]>
https://discourse.sst.dev/t/sst-v3-body-sst-dev-is-not-running/2992#post_3 Thu, 12 Dec 2024 14:03:45 +0000 discourse.sst.dev-post-8274
Alternative option for laravel forge and vapo in sst Hosting Laravel app manually in ec2 is kind of a nightmare and the framework offical hosting is vendor locked like nextjs. will sst have some solutions to this? thanks.
Some sort of abstraction of this would be great: The serverless LAMP stack part 4: Building a serverless Laravel application | AWS Compute Blog

]]>
https://discourse.sst.dev/t/alternative-option-for-laravel-forge-and-vapo-in-sst/3003#post_1 Fri, 06 Dec 2024 00:50:58 +0000 discourse.sst.dev-post-8271
Routing in SST app I have the SST app made but later down the road i have realised that i might be ending up with a lot of lambdas so i was wondering whats a good way or practice to group up similar lambdas.
all of this in a gracefull way.
then i found power tool it looked like something thats going to help with this but i am not sure how to implement it.

so either let me know if theres any existing solution or example that solved my problem or please guide me how can i implement this lambda power tool.
a really short and abstracted example might do the trick.

once again to Avoid ending up with so many lambdas is there any way i can handle similar routes like:

  • /user/ POST
  • /user/ GET
  • /user/ DELETE
  • /user/activate POST
  • /user/{id} GET

Appreciate any help !!!

]]>
https://discourse.sst.dev/t/routing-in-sst-app/3000#post_1 Thu, 28 Nov 2024 17:58:14 +0000 discourse.sst.dev-post-8268
Create an SST app I think it’s worthy mentioning to run shopt -s globstar before running
npx replace-in-file /monorepo-template/g notes **/*.* --verbose, or in some shells the replacement won’t happen.

It’s the case for my bash in both Mac and Ubuntu.

]]>
https://discourse.sst.dev/t/create-an-sst-app/2462#post_12 Fri, 22 Nov 2024 07:19:31 +0000 discourse.sst.dev-post-8266
Issue with SST Console Email Verification As it turned out there was a bad entry in our mx records. Disregard this post please.

]]>
https://discourse.sst.dev/t/issue-with-sst-console-email-verification/2993#post_2 Tue, 12 Nov 2024 18:00:12 +0000 discourse.sst.dev-post-8263
Issue with SST Console Email Verification I’m unable to access the SST Console due to verification code delivery issues. When attempting to sign in with my email, the system prompts for a verification code but I never receive the email containing the code. I’ve checked spam and all other email folders.

]]>
https://discourse.sst.dev/t/issue-with-sst-console-email-verification/2993#post_1 Sat, 09 Nov 2024 21:19:14 +0000 discourse.sst.dev-post-8259
Sst v3 {"body":"sst dev is not running"} Seems to be a problem with 3.3.x which changed the bridge to appsync.

Works fine on 3.2.76.

I noticed there was this issue created today Auth component does not work in dev mode (Live) · Issue #5034 · sst/sst · GitHub, and also a few people having this same problem on discourse, so its not just me.

Rollback to 3.2.76 will work around the problem until something can be fixed on 3.3.x.

]]>
https://discourse.sst.dev/t/sst-v3-body-sst-dev-is-not-running/2992#post_2 Fri, 08 Nov 2024 16:49:09 +0000 discourse.sst.dev-post-8258
Sst v3 {"body":"sst dev is not running"} Trying to get up and running with v3 for the first time. But I don’t seem to get anything hitting my lambda functions, they won’t log anything to the console and so on. So I set up a very simple one that responds with {statusCode: 200, body: "Connected"}. When I run under npx sst dev and try to GET it, all I get is:

{"body":"sst dev is not running"}

If I disable dev mode as follows:

        const httpApi = new sst.aws.ApiGatewayV2("MyApi");
        httpApi.route("GET /", {
            handler: "packages/functions/src/connect.main",
            dev: false
        });

It does work!

Wondering if its an IAM permissions thing, but the IAM user used for deployment has full AdministratorAcces set up on AWS.

Why is the live function feature not working?

]]>
https://discourse.sst.dev/t/sst-v3-body-sst-dev-is-not-running/2992#post_1 Fri, 08 Nov 2024 15:14:11 +0000 discourse.sst.dev-post-8257
Pulumi process is taking too much memory and cpu node process is taking 11GB and cpu shooting to 99.5% on mac book with 16gb memory.

I have stopped the sst dev process, but still memory and cpu are high for node process. I verified no other process is running.

The parent process is pulumi-language-nodejs

]]>
https://discourse.sst.dev/t/pulumi-process-is-taking-too-much-memory-and-cpu/2991#post_1 Thu, 07 Nov 2024 15:55:18 +0000 discourse.sst.dev-post-8256
It seems that your package manager failed to install the right version of the SST CLI for your platform If you trace that error to where it originates in the source code you’ll see that it just throws the error when the OS is windows.

From their docs:
“The CLI currently supports macOS, Linux, and WSL. Windows support is coming soon.”

]]>
https://discourse.sst.dev/t/it-seems-that-your-package-manager-failed-to-install-the-right-version-of-the-sst-cli-for-your-platform/2982#post_3 Tue, 22 Oct 2024 05:53:34 +0000 discourse.sst.dev-post-8255
No resources to remove I am trying to delete the extra and non-used stages from other devs in our dev account. I am unable to delete some of them as the SST cli says “No resources to remove”.

I tried refreshing and still no dice. Any ideas?

% sst refresh --stage test-stage
SST 3.2.33 ready!

➜ App: MYAPP
Stage: test-stage

~ Refresh

✓ No changes

% sst remove --stage test-stage
SST 3.2.33 ready!

➜ App: MYAPP
Stage: test-stage

~ Remove

✓ No resources to remove

]]>
https://discourse.sst.dev/t/no-resources-to-remove/2989#post_1 Mon, 21 Oct 2024 21:46:59 +0000 discourse.sst.dev-post-8253
Issue deploying sveltekit app to prod after sst version 3.1.78 When I deploy any sst sveltekit app to production I get an error unless I use an older version of sst. I’m showing the problem below with the sveltekit demo app from the sst GitHub site. This might be better submitted as a problem but I thought I’d ask here first.

Environment: Mac mini (m1), Sonoma, sst 3.2.11, node v21.7.3

Code: ion/examples/aws-svelte-kit at dev · sst/ion · GitHub

npx sst upgrade
npm update
npx sst deploy --stage prod

… standard build info up to the error …

| Created MyWeb sst:aws:SvelteKit → MyWebBuild sst:Run (1.4s)
| Created LambdaEncryptionKey random:index:RandomBytes
| Created MyWeb sst:aws:SvelteKit → MyWebServer sst:aws:Function
| Error
| Error: read /Users/tonysamsom/Desktop/ion/examples/aws-svelte-kit/.svelte-kit/svelte-kit-sst/prerendered: is a directory
| at IncomingMessage. (file:///Users/tonysamsom/Desktop/ion/examples/aws-svelte-kit/.sst/platform/src/components/rpc/rpc.ts:42:22)
| at IncomingMessage.emit (node:events:526:35)
| at IncomingMessage.emit (node:domain:488:12)
| at endReadableNT (node:internal/streams/readable:1408:12)
| at processTicksAndRejections (node:internal/process/task_queues:82:21) {
| promise: Promise { [Circular *1] }
| }
| Created MyWeb sst:aws:SvelteKit → MyWebServerCachePolicy aws:cloudfront:CachePolicy
| Created MyWeb sst:aws:SvelteKit → MyWebServerLogGroup aws:cloudwatch:LogGroup
| Created MyWeb sst:aws:SvelteKit → MyWebAssetFiles sst:aws:BucketFiles (1.3s)
| Created MyWeb sst:aws:SvelteKit → MyWebServerRole aws:iam:Role (1.3s)
| Created MyWeb sst:aws:SvelteKit → MyWebCdn sst:aws:CDN
| Created MyWeb sst:aws:SvelteKit → MyWebCloudfrontFunctionServerCfFunction aws:cloudfront:Function (2.9s)

…… downgrading sst with the example code successfully deploys

npx sst upgrade 3.1.78
npm update
npx sst deploy --stage prod

✓ Complete
MyWeb: https://d2a8v20tfn3pxn.cloudfront.net

]]>
https://discourse.sst.dev/t/issue-deploying-sveltekit-app-to-prod-after-sst-version-3-1-78/2988#post_1 Sun, 13 Oct 2024 16:03:47 +0000 discourse.sst.dev-post-8252
I am facing Problems When Using SST and Seed to Deploy Several Environments Hello everyone,

I am working on a serverless project using SST and deploying with Seed & i am facing some challenges managing multiple environment; While SST and Seed seem to handle this well I have found it tricky to keep the configurations consistent across these environments without duplicating code or running into issues with environment variable.

For those who have deployed multi-environment setup with SST and Seed how do u manage configurations and secrets effectively across different stages?? Do you use a particular strategy to keep things DRY & avoid issues when scaling the app?

Also i have check this resorse & article https://discourse.sst.dev/t/how-are-sst-serverless-framework-meant-to-be-used-together/learn looker

Thank you.

]]>
https://discourse.sst.dev/t/i-am-facing-problems-when-using-sst-and-seed-to-deploy-several-environments/2987#post_1 Fri, 11 Oct 2024 09:28:33 +0000 discourse.sst.dev-post-8251
SST v3: Facing an issue while setting up Cognito Identity pool TypeError: pulumi.runtime.invokeOutput is not a function
| at getRegionOutput (/Users/deevan.kumar/ssr/repo/user-service/.sst/platform/node_modules/@pulumi/getRegion.ts:93:27)
| at getRegion (file:///Users/deevan.kumar/ssr/repo/user-service/.sst/platform/src/components/aws/cognito-identity-pool.ts:169:14)
| at new _CognitoIdentityPool (file:///Users/deevan.kumar/ssr/repo/user-service/.sst/platform/src/components/aws/cognito-identity-pool.ts:158:20)
| at run (file:///Users/deevan.kumar/ssr/repo/user-service/sst.config.ts:54:25)
| at run (file:///Users/deevan.kumar/ssr/repo/user-service/.sst/platform/src/auto/run.ts:32:26)
| at file:///Users/deevan.kumar/ssr/repo/user-service/eval.ts:4:28
| at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
| at ModuleLoader.import (node:internal/modules/esm/loader:329:24)
| at importModuleDynamicallyWrapper (node:internal/vm/module:431:15)

Code looks below:
const identitypool = new sst.aws.CognitoIdentityPool(“test”,{
userPools:[
{
userPool: userPool.id,
client: client.id
}
]
});

]]>
https://discourse.sst.dev/t/sst-v3-facing-an-issue-while-setting-up-cognito-identity-pool/2985#post_1 Mon, 07 Oct 2024 02:40:08 +0000 discourse.sst.dev-post-8249
What Does This Guide Cover? Apparently, the latest version of sst and the latest version of this guide does not support the Windows operating system. If this is true, maybe this information should be added to the Requirements section of this “What Does This Guide Cover?” chapter, along with the ideal operating system recommendation for sst. I’m debating whether to go back to v2.sst.dev, switch to another operating system for development, or investigate other methods of creating a full stack web app.

]]>
https://discourse.sst.dev/t/what-does-this-guide-cover/83#post_9 Wed, 25 Sep 2024 13:09:49 +0000 discourse.sst.dev-post-8247
It seems that your package manager failed to install the right version of the SST CLI for your platform I’m getting the same error trying to work through the latest version of the SST guide to build the example full stack notes/Scratch app. I went through this guide several months ago and everything worked out. I wanted to do a refresher before I start a real project, and it seems that everything is different now and it doesn’t work anymore. I saw somewhere a recommendation to use…

npm install sst@two --save-exact

…and that seems to install version 2.43.7 of sst instead of 3.1.38. It seems like version 2 of sst does work on Windows, but it doesn’t work with the current guide. The next error I get when I run…

npx sst dev

…is

PS C:\Dev\notes> npx sst dev

Error: $config is not defined

Trace: ReferenceError: $config is not defined
at file:///C:/Dev/notes/.sst.config.1727266767391.mjs:42:26
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async load (file:///C:/Dev/notes/node_modules/sst/stacks/build.js:101:21)
at async file:///C:/Dev/notes/node_modules/sst/project.js:49:40
at async initProject (file:///C:/Dev/notes/node_modules/sst/project.js:43:35)
at async file:///C:/Dev/notes/node_modules/sst/cli/program.js:36:9
at process. (file:///C:/Dev/notes/node_modules/sst/cli/sst.js:58:21)
at process.emit (node:events:530:35)
at process.emit (node:domain:488:12)
at process._fatalException (node:internal/process/execution:178:25)
at processPromiseRejections (node:internal/process/promises:289:13)
at process.processTicksAndRejections (node:internal/process/task_queues:96:32)

]]>
https://discourse.sst.dev/t/it-seems-that-your-package-manager-failed-to-install-the-right-version-of-the-sst-cli-for-your-platform/2982#post_2 Wed, 25 Sep 2024 12:20:16 +0000 discourse.sst.dev-post-8246
It seems that your package manager failed to install the right version of the SST CLI for your platform Hi, I am trying to set up sst on nextjs app. I have a message saying:
It seems that your package manager failed to install the right version of the SST CLI for your platform. You can try manually installing the “sst-win32-x64” package.

]]>
https://discourse.sst.dev/t/it-seems-that-your-package-manager-failed-to-install-the-right-version-of-the-sst-cli-for-your-platform/2982#post_1 Thu, 19 Sep 2024 15:07:44 +0000 discourse.sst.dev-post-8244
Next.js api route streaming data Hi, is it possible to stream data from a Next.js api route when my SST stack is deployed to prod? This is my first time using SST, so it’s not clear to me what the limitations are.

I have created a simple Next.js site that contains an api route (app router). The api route accepts a payload via POST with some data. Then it calls the OpenAI api to retrieve a response. I want to stream that response back to my client component (similar to the ChatGPT interface). I have this working when running my SST stack in dev, but once I deploy it to prod, the response is no longer streamed, it just returns the full data once complete. Here is the code that does the stream/response:

  const headers = new Headers({
    "Content-Type": "text/plain; charset=utf-8",
    "Transfer-Encoding": "chunked",
  });

  const stream = new ReadableStream({
    async start(controller) {
      try {
        const openaiStream = await openai.chat.completions.create({
          model: model.id,
          messages,
          stream: true,
        });

        for await (const chunk of openaiStream) {
          const content = chunk.choices[0]?.delta?.content || "";
          controller.enqueue(new TextEncoder().encode(content));
        }

        controller.close();
      } catch (error) {
        console.error("Error calling OpenAI API:", error);
        controller.error(error);
      }
    },
  });

  return new NextResponse(stream, { headers });
]]>
https://discourse.sst.dev/t/next-js-api-route-streaming-data/2979#post_1 Mon, 16 Sep 2024 19:45:29 +0000 discourse.sst.dev-post-8241
Why my post has been hidden? Yeah I approved it. It’s just the auto spam filter that Discourse has. I don’t know why it does that.

]]>
https://discourse.sst.dev/t/why-my-post-has-been-hidden/2972#post_2 Fri, 06 Sep 2024 20:47:00 +0000 discourse.sst.dev-post-8238
Why my post has been hidden? Hello there,

Recently I posted a query on this website- https://discourse.sst.dev/t/akismet-has-temporarily-hidden-your-post/2970

After few minutes, I got a notification that left me disappointed as it shows my content is Hidden. I don’t know what is the reason behind it but I didn’t do anything wrong that violate community guideline. As a professional, I respect community guideline and make useful contribution to help community members. As my query is genuine and I really need a quick solution to that and I don’t think there is better platform than this to solve my query.

Kindly have a look at my post and make it live again.

]]>
https://discourse.sst.dev/t/why-my-post-has-been-hidden/2972#post_1 Sun, 01 Sep 2024 09:50:45 +0000 discourse.sst.dev-post-8233
Could Someone Give me Advice for Integrating SST with an Existing Serverless Application? Hello there,

I am working on integrating SST into an existing serverless application and could use some guidance on best practices. My application is built on AWS; utilizing Lambda; DynamoDB; API Gateway; and S3; with a deployment pipeline already set up using CI/CD. I have read through the SST documentation; but there are a few areas where I’m hoping to get some insights from those with experience in this domain.

My current application has a standard serverless.yml setup. How should I approach restructuring my project to incorporate SST? Should I migrate everything into SST at once; or is there a way to incrementally adopt SST? :thinking:

One of the key reasons I am exploring SST is for its live Lambda debugging capabilities. Could anyone share their experiences with this feature; especially in terms of how it integrates with existing testing frameworks like Jest or Mocha? Are there any pitfalls I should be aware of? :thinking:

My application is deployed across multiple environments. How does SST handle environment-specific configurations; especially when it comes to managing secrets and environment variables? :thinking:

Also, I have gone through this post; https://discourse.sst.dev/t/provide-sst-construct-for-api-gateway-integration-mlops/ which definitely helped me out a lot.

I am particularly interested in hearing about real world experiences and any lessons learned during the migration process.

Thank you in advance for your help and assistance. :innocent:

]]>
https://discourse.sst.dev/t/could-someone-give-me-advice-for-integrating-sst-with-an-existing-serverless-application/2969#post_1 Wed, 28 Aug 2024 07:09:58 +0000 discourse.sst.dev-post-8229
Adding Auth to Our Serverless App Oh that’s from a previous version. It should be referencing the snippet from above instead.

     {
        actions: ["s3:*"],
        resources: [
          $concat(bucket.arn, "/private/${cognito-identity.amazonaws.com:sub}/*"),
        ],
      },
]]>
https://discourse.sst.dev/t/adding-auth-to-our-serverless-app/2457#post_12 Wed, 21 Aug 2024 20:02:06 +0000 discourse.sst.dev-post-8226
Adding Auth to Our Serverless App BBCODE

new iam.PolicyStatement({
  actions: ["s3:*"],
  effect: iam.Effect.ALLOW,
  resources: [
    bucket.bucketArn + "/private/${cognito-identity.amazonaws.com:sub}/*",
  ],
}),

where this code need to be placed

]]>
https://discourse.sst.dev/t/adding-auth-to-our-serverless-app/2457#post_11 Sun, 18 Aug 2024 10:53:12 +0000 discourse.sst.dev-post-8223
How to use PostgreSQL in your serverless app This example no longer works, returning:

ExampleStack Cluster/Cluster AWS::RDS::DBCluster CREATE_FAILED Resource handler returned message: "The engine mode serverless you requested is currently unavailable. (Service: Rds, Status Code: 400, Request ID: 1234)" (RequestToken: 1234, HandlerErrorCode: InvalidRequest)

After reading your “Moving away from CDK” blog post, I understand that fixing this issue won’t be worth anyone’s time.

I’ll have a look at the Ion-based setup.
Hope this comment spared someone time before going to deep debugging it :wink:

]]>
https://discourse.sst.dev/t/how-to-use-postgresql-in-your-serverless-app/2409#post_9 Sun, 11 Aug 2024 14:06:09 +0000 discourse.sst.dev-post-8219
Secure Our Serverless APIs Appreciate the feedback!

]]>
https://discourse.sst.dev/t/secure-our-serverless-apis/2467#post_12 Thu, 08 Aug 2024 17:09:32 +0000 discourse.sst.dev-post-8217
How to debug Lambda functions with Visual Studio Code Obviously, this debugging setup doesn’t work anymore for Ion.

The launch.json config needs to change from

"runtimeArgs": ["start", "--increase-timeout"],

to

"runtimeArgs": ["dev"],

to start.

Haven’t figured out how to increase the timeout so far.

Also there is following warning:

Warning: You are using a global installation of SST but you also have a local installation specified in your package.json. The local installation will be used but you should typically run it through your package manager.

I also created an issue for it.

]]>
https://discourse.sst.dev/t/how-to-debug-lambda-functions-with-visual-studio-code/2388#post_5 Thu, 08 Aug 2024 15:00:11 +0000 discourse.sst.dev-post-8216
Secure Our Serverless APIs Hi @jayair,

I am currently working through the SST intro notes tutorial.
Thanks, for the nice introduction!

There are just two things, I struggled a bit so far:

  • get all the command line stuff working.
  • creating the AWS accounts could have been much easier
  1. AWS Accounts
    It would have been great to see Adam’s video about AWS federated accounts before starting. Spent a lot of time to set up Accounts and IAM users the wrong way before starting. Maybe link it in the first chapter, before it’s going into the weeds?

  2. CLI Tools
    For the cli calls, it would be nice to have a .env file with all the necessary variables to be filled out during the tutorial.

.env:

API_ENDPOINT=https://YOUR-STACK-ID.execute-api.us-east-1.amazonaws.com
USER_POOL_CLIENT_ID=
IDENTITY_POOL_ID=
API_REGION=us-east-1
COGNITO_REGION=us-east-1
USER_POOL_ID=


STRIPE_SECRET_TEST_KEY=fill out
STRIPE_PUBLISHABLE_KEY=fill out

And then the CLI calls in little shell scripts, loading the .env file. E.g. 01_test_user_signup.sh:

source .env

AWS_PROFILE=plain-dev-sst aws cognito-idp sign-up \
  --region ${COGNITO_REGION} \
  --client-id ${USER_POOL_CLIENT_ID} \
  --username [email protected] \
  --password Passw0rd!

02_test_user_admin_confirm_signup.sh:

source .env

AWS_PROFILE=plain-dev-sst aws cognito-idp admin-confirm-sign-up \
  --region ${COGNITO_REGION} \
  --user-pool-id ${USER_POOL_ID} \
  --username [email protected]

This would reduce room for error.

I hope this thread isn’t some kind of /dev/null btw.

Thanks for considering, and thanks for the great framework so far!

Greets,
Andreas

]]>
https://discourse.sst.dev/t/secure-our-serverless-apis/2467#post_11 Tue, 06 Aug 2024 10:50:10 +0000 discourse.sst.dev-post-8214
Deploying Through the SST Console Link to the chapter — https://sst.dev/chapters/deploying-through-the-sst-console.html

]]>
https://discourse.sst.dev/t/deploying-through-the-sst-console/2958#post_1 Wed, 24 Jul 2024 23:44:57 +0000 discourse.sst.dev-post-8212
Setting up the SST Console Link to the chapter — https://sst.dev/chapters/setting-up-the-sst-console.html

]]>
https://discourse.sst.dev/t/setting-up-the-sst-console/2957#post_1 Wed, 24 Jul 2024 23:40:44 +0000 discourse.sst.dev-post-8211
Working with aws cdk package I like the concept of SST, but to use it, I need to make sure,

I use the Amazon-cognito-passwordless-auth package in my project. Does it work with your framework?

]]>
https://discourse.sst.dev/t/working-with-aws-cdk-package/2953#post_1 Thu, 11 Jul 2024 08:24:27 +0000 discourse.sst.dev-post-8207
How to set runtime parameter of python for sst app? When I run npm run deploy -- --stage=production I get the following error:

   ReactSite-sebastian/S3Uploader: Resource handler returned message: "The runtime parameter of python3.7 is no longer supported for creating or updating AWS Lambda funct
ions. We recommend you use the new runtime (python3.12) while creating or updating functions. (Service: Lambda, Status Code: 400, Request ID: 06729a42-d421-4cb1-8ed8-7982f15c39cf)" (RequestToken: 9805f32c-22a1-dc80-a13c-9874c541cb11, HandlerErrorCode: InvalidRequest)

sst.config.ts

export default {
    config(input) {
        const PROFILE: Record<string, string> = {
            dev: "staging",
            production: "production",
            default: "admin",
        }

        console.log("stage:", input.stage, input);

        return {
            name: "sst-app",
            region: "eu-central-1",
            profile: "default",
            stage: input.stage,
        }
    },
    stacks(app: App) {
        app.setDefaultFunctionProps({
            runtime: "nodejs18.x",
            architecture: "arm_64",
        });

        // Remove all resources when non-prod stages are removed
        if (app.stage !== "production") {
            app.setDefaultRemovalPolicy(RemovalPolicy.DESTROY);
        }

        app
            .stack(StorageStack)
            .stack(AuthStack)
            .stack(ApiStack)
            .stack(WebsocketApiStack)
            .stack(FrontendStack);
    },
} satisfies SSTConfig

The funny thing is that I dont even use python for lambda functions, I only use typescript for lambda functions. I think it might have gotten confused by my single utility python files that reside in my project.

]]>
https://discourse.sst.dev/t/how-to-set-runtime-parameter-of-python-for-sst-app/2951#post_1 Mon, 08 Jul 2024 14:50:17 +0000 discourse.sst.dev-post-8205