Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/core/src/db/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ async function initClient(): Promise<void> {
// Postgres — dynamically import to avoid bundling in non-Postgres runtimes
if (dialect === "postgres") {
const { default: postgres } = await import("postgres");
_pgPool = postgres(url);
_pgPool = postgres(url, {
onnotice: () => {}, // Suppress CREATE TABLE IF NOT EXISTS notices
});
const pool = _pgPool;

_exec = {
Expand Down
8 changes: 5 additions & 3 deletions templates/mail/server/handlers/emails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ async function getAccessToken(accountEmail: string): Promise<string | null> {
async function getAccountTokens(
forEmail?: string,
): Promise<Array<{ email: string; accessToken: string }>> {
const accounts = forEmail
? await listOAuthAccountsByOwner("google", forEmail)
: await listOAuthAccounts("google");
// In dev mode (local@localhost), show all accounts regardless of owner
const accounts =
forEmail && forEmail !== "local@localhost"
? await listOAuthAccountsByOwner("google", forEmail)
: await listOAuthAccounts("google");

const results: Array<{ email: string; accessToken: string }> = [];

Expand Down
6 changes: 4 additions & 2 deletions templates/mail/server/lib/google-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ export async function getClients(
* checks only that specific account.
*/
export async function isConnected(forEmail?: string): Promise<boolean> {
if (forEmail) {
// In dev mode, check all accounts regardless of owner
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 getClients() still filters by owner in dev mode — inbox silently empty

isConnected() now bypasses the owner filter for local@localhost, but getClients() immediately above it does not. When listEmails runs in dev mode: (1) isConnected("local@localhost") returns true via hasOAuthTokens, (2) listGmailMessages(..., "local@localhost") calls getClients("local@localhost") which still calls listOAuthAccountsByOwner("google", "local@localhost")[], (3) returns {messages:[], errors:[]} silently. Apply the same forEmail && forEmail !== "local@localhost" guard inside getClients() to complete the fix.


How did I do? React with 👍 or 👎 to help me improve.

if (forEmail && forEmail !== "local@localhost") {
const accounts = await listOAuthAccountsByOwner("google", forEmail);
return accounts.length > 0;
}
Expand Down Expand Up @@ -263,7 +264,8 @@ export async function getAuthStatus(
accountId: string;
tokens: Record<string, unknown>;
}>;
if (forEmail) {
// In dev mode (local@localhost), show all accounts regardless of owner
if (forEmail && forEmail !== "local@localhost") {
oauthAccounts = await listOAuthAccountsByOwner("google", forEmail);
} else {
oauthAccounts = await listOAuthAccounts("google");
Expand Down
Loading