-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
secretArn and clusterArn undefined AWS RDS, Next.js, Drizzle #1293
Comments
What version of sst are you on? |
I'm on sst version 3.2.26 and following this guide https://sst.dev/docs/start/aws/drizzle and this one from drizzle https://orm.drizzle.team/docs/connect-aws-data-api-pg.
is for Aurora only? What should I do if I want to use RDS? |
The drizzle docs for this have not been updated yet and it's showing the old way of doing it. The new way would look something like this: // drizzle.config.ts
import { defineConfig } from "drizzle-kit";
import { Resource } from "sst";
export default defineConfig({
dialect: "postgresql",
dbCredentials: {
user: Resource.MyDatabase.username,
password: Resource.MyDatabase.password,
host: Resource.MyDatabase.host,
port: Resource.MyDatabase.port,
database: Resource.MyDatabase.database,
},
schema: ["./src/**/*.sql.ts"],
out: "../../migrations",
}); // sst.config.ts
/// <reference path="./.sst/platform/config.d.ts" />
export default $config({
app(input) {
return {
name: "project-name-here",
removal: input?.stage === "production" ? "retain" : "remove",
home: "aws",
};
},
async run() {
const vpc = new sst.aws.Vpc("MyVpc", {
bastion: true, // enable this if you want to use sst tunnel to connect to the database from your local machine
});
const database = new sst.aws.Postgres("MyDatabase", {
vpc,
});
new sst.aws.Nextjs("MyWeb", {
vpc,
link: [database],
});
},
}); import { Resource } from "sst";
import { drizzle } from "drizzle-orm/node-postgres";
import { Pool } from "pg";
const client = new Pool({
user: Resource.MyDatabase.username,
password: Resource.MyDatabase.password,
database: Resource.MyDatabase.database,
host: Resource.MyDatabase.host,
port: Resource.MyDatabase.port,
});
export const db = drizzle(client, {
logger:
process.env.DRIZZLE_LOG === "true"
? {
logQuery(query, params) {
console.log("query:", query);
console.log("params:", params);
},
}
: undefined,
}); |
Using AWS RDS, Next.js, Drizzle and getting this error when trying to do migration or open drizzle studio:
Everything deployed with no errors, just can't get ARN
Originally posted by @lxhan in #623 (comment)
The text was updated successfully, but these errors were encountered: