From daf317b0a72c96eb815e473ea8d283c63586def9 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 26 Feb 2025 13:19:59 +0000 Subject: [PATCH 01/10] Bump version to 3.4.18 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 8ea860e3c4..055b8b5ca8 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", - "version": "3.4.17", + "version": "3.4.18", "npmClient": "yarn", "concurrency": 20, "command": { From eefcfb3c0f22e7d20d58a02ee782262472b13e96 Mon Sep 17 00:00:00 2001 From: Christos Alexiou Date: Wed, 26 Feb 2025 15:43:26 +0200 Subject: [PATCH 02/10] Update before installing --- hosting/single/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosting/single/Dockerfile b/hosting/single/Dockerfile index 1f449e7376..75b1a12d12 100644 --- a/hosting/single/Dockerfile +++ b/hosting/single/Dockerfile @@ -92,7 +92,7 @@ COPY hosting/single/ssh/sshd_config /etc/ COPY hosting/single/ssh/ssh_setup.sh /tmp # setup letsencrypt certificate -RUN apt-get install -y certbot python3-certbot-nginx +RUN apt-get update && apt-get install -y certbot python3-certbot-nginx COPY hosting/letsencrypt /app/letsencrypt RUN chmod +x /app/letsencrypt/certificate-request.sh /app/letsencrypt/certificate-renew.sh From 7b9cc6eea4263a2f4c716121230ae59864461d95 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 26 Feb 2025 14:11:40 +0000 Subject: [PATCH 03/10] Bump version to 3.4.19 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 055b8b5ca8..03be6e46bc 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", - "version": "3.4.18", + "version": "3.4.19", "npmClient": "yarn", "concurrency": 20, "command": { From 606c4475ad8f6aed56b64b14c7fa017cc0e7db39 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 26 Feb 2025 14:29:39 +0000 Subject: [PATCH 04/10] Revert "Improve types around `nodemailer`" --- .../tests/steps/sendSmtpEmail.spec.ts | 20 +++++----- .../server/src/utilities/workerRequests.ts | 40 ++++++++----------- packages/types/package.json | 1 - packages/types/src/api/web/global/email.ts | 9 ++--- .../documents/app/automation/automation.ts | 8 ++-- packages/worker/package.json | 1 - .../src/api/controllers/global/email.ts | 7 +--- packages/worker/src/utilities/email.ts | 7 ++-- yarn.lock | 13 ++---- 9 files changed, 42 insertions(+), 64 deletions(-) diff --git a/packages/server/src/automations/tests/steps/sendSmtpEmail.spec.ts b/packages/server/src/automations/tests/steps/sendSmtpEmail.spec.ts index 7aff612a97..7452239dfa 100644 --- a/packages/server/src/automations/tests/steps/sendSmtpEmail.spec.ts +++ b/packages/server/src/automations/tests/steps/sendSmtpEmail.spec.ts @@ -1,4 +1,3 @@ -import { SendEmailResponse } from "@budibase/types" import TestConfiguration from "../../../tests/utilities/TestConfiguration" import * as workerRequests from "../../../utilities/workerRequests" @@ -6,18 +5,17 @@ jest.mock("../../../utilities/workerRequests", () => ({ sendSmtpEmail: jest.fn(), })) -function generateResponse(to: string, from: string): SendEmailResponse { +function generateResponse(to: string, from: string) { return { - message: `Email sent to ${to}.`, - accepted: [to], - envelope: { - from: from, - to: [to], + success: true, + response: { + accepted: [to], + envelope: { + from: from, + to: [to], + }, + message: `Email sent to ${to}.`, }, - messageId: "messageId", - pending: [], - rejected: [], - response: "response", } } diff --git a/packages/server/src/utilities/workerRequests.ts b/packages/server/src/utilities/workerRequests.ts index dd1493b82f..0f487d9f31 100644 --- a/packages/server/src/utilities/workerRequests.ts +++ b/packages/server/src/utilities/workerRequests.ts @@ -8,15 +8,7 @@ import { logging, env as coreEnv, } from "@budibase/backend-core" -import { - Ctx, - User, - EmailInvite, - EmailAttachment, - SendEmailResponse, - SendEmailRequest, - EmailTemplatePurpose, -} from "@budibase/types" +import { Ctx, User, EmailInvite, EmailAttachment } from "@budibase/types" interface Request { ctx?: Ctx @@ -118,23 +110,25 @@ export async function sendSmtpEmail({ invite?: EmailInvite }) { // tenant ID will be set in header - const request: SendEmailRequest = { - email: to, - from, - contents, - subject, - cc, - bcc, - purpose: EmailTemplatePurpose.CUSTOM, - automation, - invite, - attachments, - } const response = await fetch( checkSlashesInUrl(env.WORKER_URL + `/api/global/email/send`), - createRequest({ method: "POST", body: request }) + createRequest({ + method: "POST", + body: { + email: to, + from, + contents, + subject, + cc, + bcc, + purpose: "custom", + automation, + invite, + attachments, + }, + }) ) - return (await checkResponse(response, "send email")) as SendEmailResponse + return checkResponse(response, "send email") } export async function removeAppFromUserRoles(ctx: Ctx, appId: string) { diff --git a/packages/types/package.json b/packages/types/package.json index a6e08ab84c..ee3c059bc9 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -17,7 +17,6 @@ "@budibase/nano": "10.1.5", "@types/json-schema": "^7.0.15", "@types/koa": "2.13.4", - "@types/nodemailer": "^6.4.17", "@types/redlock": "4.0.7", "koa-useragent": "^4.1.0", "rimraf": "3.0.2", diff --git a/packages/types/src/api/web/global/email.ts b/packages/types/src/api/web/global/email.ts index 3d2e007231..a0ca0e8485 100644 --- a/packages/types/src/api/web/global/email.ts +++ b/packages/types/src/api/web/global/email.ts @@ -1,5 +1,4 @@ import { EmailAttachment, EmailInvite } from "../../../documents" -import SMTPTransport from "nodemailer/lib/smtp-transport" export enum EmailTemplatePurpose { CORE = "core", @@ -13,17 +12,17 @@ export enum EmailTemplatePurpose { export interface SendEmailRequest { workspaceId?: string email: string - userId?: string + userId: string purpose: EmailTemplatePurpose contents?: string from?: string subject: string - cc?: string - bcc?: string + cc?: boolean + bcc?: boolean automation?: boolean invite?: EmailInvite attachments?: EmailAttachment[] } -export interface SendEmailResponse extends SMTPTransport.SentMessageInfo { +export interface SendEmailResponse extends Record { message: string } diff --git a/packages/types/src/documents/app/automation/automation.ts b/packages/types/src/documents/app/automation/automation.ts index cfe2ba5147..d5ef35d059 100644 --- a/packages/types/src/documents/app/automation/automation.ts +++ b/packages/types/src/documents/app/automation/automation.ts @@ -1,10 +1,10 @@ import { Document } from "../../document" import { User } from "../../global" +import { ReadStream } from "fs" import { Row } from "../row" import { Table } from "../table" import { AutomationStep, AutomationTrigger } from "./schema" import { ContextEmitter } from "../../../sdk" -import { Readable } from "stream" export enum AutomationIOType { OBJECT = "object", @@ -108,8 +108,8 @@ export interface SendEmailOpts { subject: string // info Pass in a structure of information to be stored alongside the invitation. info?: any - cc?: string - bcc?: string + cc?: boolean + bcc?: boolean automation?: boolean invite?: EmailInvite attachments?: EmailAttachment[] @@ -269,7 +269,7 @@ export type AutomationAttachment = { export type AutomationAttachmentContent = { filename: string - content: Readable + content: ReadStream | NodeJS.ReadableStream } export type BucketedContent = AutomationAttachmentContent & { diff --git a/packages/worker/package.json b/packages/worker/package.json index edaab50d78..28728272ca 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -86,7 +86,6 @@ "@types/koa__router": "12.0.4", "@types/lodash": "4.14.200", "@types/node-fetch": "2.6.4", - "@types/nodemailer": "^6.4.17", "@types/server-destroy": "1.0.1", "@types/supertest": "2.0.14", "@types/uuid": "8.3.4", diff --git a/packages/worker/src/api/controllers/global/email.ts b/packages/worker/src/api/controllers/global/email.ts index ed2d9b5125..ad0fc3fa32 100644 --- a/packages/worker/src/api/controllers/global/email.ts +++ b/packages/worker/src/api/controllers/global/email.ts @@ -24,13 +24,10 @@ export async function sendEmail( invite, attachments, } = ctx.request.body - let user: User | undefined = undefined + let user: any if (userId) { const db = tenancy.getGlobalDB() - user = await db.tryGet(userId) - } - if (!user) { - ctx.throw(404, "User not found.") + user = await db.get(userId) } const response = await sendEmailFn(email, purpose, { workspaceId, diff --git a/packages/worker/src/utilities/email.ts b/packages/worker/src/utilities/email.ts index a2b9c3bfc2..fa9dd7a6fa 100644 --- a/packages/worker/src/utilities/email.ts +++ b/packages/worker/src/utilities/email.ts @@ -13,8 +13,7 @@ import { configs, cache, objectStore } from "@budibase/backend-core" import ical from "ical-generator" import _ from "lodash" -import nodemailer from "nodemailer" -import SMTPTransport from "nodemailer/lib/smtp-transport" +const nodemailer = require("nodemailer") const TEST_MODE = env.ENABLE_EMAIL_TEST_MODE && env.isDev() const TYPE = TemplateType.EMAIL @@ -27,7 +26,7 @@ const FULL_EMAIL_PURPOSES = [ ] function createSMTPTransport(config?: SMTPInnerConfig) { - let options: SMTPTransport.Options + let options: any let secure = config?.secure // default it if not specified if (secure == null) { @@ -162,7 +161,7 @@ export async function sendEmail( const code = await getLinkCode(purpose, email, opts.user, opts?.info) let context = await getSettingsTemplateContext(purpose, code) - let message: Parameters[0] = { + let message: any = { from: opts?.from || config?.from, html: await buildEmail(purpose, email, context, { user: opts?.user, diff --git a/yarn.lock b/yarn.lock index 445e0abc18..48eaaf4ecd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2785,9 +2785,9 @@ through2 "^2.0.0" "@budibase/pro@npm:@budibase/pro@latest": - version "3.4.16" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-3.4.16.tgz#c482a400e27b7e89ca73092c4c81bdeac1d24581" - integrity sha512-8ECnqOh9jQ10KlQEwmKPFcoVGE+2gGgSybj+vbshwDp1zAW76doyMR2DMNjEatNpWVnpoMnTkDWtE9aqQ5v0vQ== + version "3.4.12" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-3.4.12.tgz#60e630944de4e2de970a04179d8f0f57d48ce75e" + integrity sha512-msUBmcWxRDg+ugjZvd27XudERQqtQRdiARsO8MaDVTcp5ejIXgshEIVVshHOCj3hcbRblw9pXvBIMI53iTMUsA== dependencies: "@anthropic-ai/sdk" "^0.27.3" "@budibase/backend-core" "*" @@ -6775,13 +6775,6 @@ dependencies: undici-types "~6.19.2" -"@types/nodemailer@^6.4.17": - version "6.4.17" - resolved "https://registry.yarnpkg.com/@types/nodemailer/-/nodemailer-6.4.17.tgz#5c82a42aee16a3dd6ea31446a1bd6a447f1ac1a4" - integrity sha512-I9CCaIp6DTldEg7vyUTZi8+9Vo0hi1/T8gv3C89yk1rSAAzoKQ8H8ki/jBYJSFoH/BisgLP8tkZMlQ91CIquww== - dependencies: - "@types/node" "*" - "@types/normalize-package-data@^2.4.0": version "2.4.1" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301" From d6d32ceaadde4597554f786d6e98317df2674ddf Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 26 Feb 2025 14:49:09 +0000 Subject: [PATCH 05/10] Bump version to 3.4.20 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 03be6e46bc..b391c8e05c 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", - "version": "3.4.19", + "version": "3.4.20", "npmClient": "yarn", "concurrency": 20, "command": { From 06d00d69b2660ed98648161785453ef93cbea83c Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 26 Feb 2025 15:23:49 +0000 Subject: [PATCH 06/10] Debug testcontainers. --- .github/workflows/budibase_ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 6a9aa3e8d0..97cfe88804 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -235,6 +235,7 @@ jobs: - name: Test server env: DATASOURCE: ${{ matrix.datasource }} + DEBUG: testcontainers* run: | if ${{ env.ONLY_AFFECTED_TASKS }}; then AFFECTED=$(yarn --silent nx show projects --affected -t test --base=${{ env.NX_BASE_BRANCH }} -p @budibase/server) From f604aba7ba278915e65329858ad39607510c5ebe Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 26 Feb 2025 15:41:09 +0000 Subject: [PATCH 07/10] Try ubuntu-latest --- .github/workflows/budibase_ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 97cfe88804..af3950a439 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -30,7 +30,7 @@ env: jobs: lint: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v4 @@ -47,7 +47,7 @@ jobs: - run: yarn lint build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v4 @@ -76,7 +76,7 @@ jobs: fi helm-lint: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v4 @@ -88,7 +88,7 @@ jobs: - run: cd charts/budibase && helm lint . test-libraries: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v4 @@ -122,7 +122,7 @@ jobs: fi test-worker: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout repo uses: actions/checkout@v4 @@ -151,7 +151,7 @@ jobs: yarn test --verbose --reporters=default --reporters=github-actions test-server: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: matrix: datasource: @@ -254,7 +254,7 @@ jobs: yarn test --filter $FILTER --verbose --reporters=default --reporters=github-actions check-pro-submodule: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest if: inputs.run_as_oss != true && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase') steps: - name: Checkout repo and submodules @@ -313,7 +313,7 @@ jobs: fi check-lockfile: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest if: inputs.run_as_oss != true && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase') steps: - name: Checkout repo From 9076d847c19cb9f855101e38213e213c7e402738 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 26 Feb 2025 15:48:26 +0000 Subject: [PATCH 08/10] Update to mssql 2022 to see if that helps. --- .github/workflows/budibase_ci.yml | 16 ++++++++-------- packages/server/datasource-sha.env | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index af3950a439..91c32359d2 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -30,7 +30,7 @@ env: jobs: lint: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout repo uses: actions/checkout@v4 @@ -47,7 +47,7 @@ jobs: - run: yarn lint build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout repo uses: actions/checkout@v4 @@ -76,7 +76,7 @@ jobs: fi helm-lint: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout repo uses: actions/checkout@v4 @@ -88,7 +88,7 @@ jobs: - run: cd charts/budibase && helm lint . test-libraries: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout repo uses: actions/checkout@v4 @@ -122,7 +122,7 @@ jobs: fi test-worker: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout repo uses: actions/checkout@v4 @@ -151,7 +151,7 @@ jobs: yarn test --verbose --reporters=default --reporters=github-actions test-server: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 strategy: matrix: datasource: @@ -254,7 +254,7 @@ jobs: yarn test --filter $FILTER --verbose --reporters=default --reporters=github-actions check-pro-submodule: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 if: inputs.run_as_oss != true && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase') steps: - name: Checkout repo and submodules @@ -313,7 +313,7 @@ jobs: fi check-lockfile: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 if: inputs.run_as_oss != true && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Budibase/budibase') steps: - name: Checkout repo diff --git a/packages/server/datasource-sha.env b/packages/server/datasource-sha.env index 383fb191f4..69750793ce 100644 --- a/packages/server/datasource-sha.env +++ b/packages/server/datasource-sha.env @@ -1,4 +1,4 @@ -MSSQL_SHA=sha256:3b913841850a4d57fcfcb798be06acc88ea0f2acc5418bc0c140a43e91c4a545 +MSSQL_SHA=sha256:d252932ef839c24c61c1139cc98f69c85ca774fa7c6bfaaa0015b7eb02b9dc87 MYSQL_SHA=sha256:9de9d54fecee6253130e65154b930978b1fcc336bcc86dfd06e89b72a2588ebe POSTGRES_SHA=sha256:bd0d8e485d1aca439d39e5ea99b931160bd28d862e74c786f7508e9d0053090e MONGODB_SHA=sha256:afa36bca12295b5f9dae68a493c706113922bdab520e901bd5d6c9d7247a1d8d From 82e32b3db84fa2562c332d4190476c8f13bea8b6 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 26 Feb 2025 15:56:32 +0000 Subject: [PATCH 09/10] Fix healthcheck. --- packages/server/src/integrations/tests/utils/mssql.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/integrations/tests/utils/mssql.ts b/packages/server/src/integrations/tests/utils/mssql.ts index 548631a987..d84fb5d12d 100644 --- a/packages/server/src/integrations/tests/utils/mssql.ts +++ b/packages/server/src/integrations/tests/utils/mssql.ts @@ -23,7 +23,7 @@ export async function getDatasource(): Promise { }) .withWaitStrategy( Wait.forSuccessfulCommand( - "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Password_123 -q 'SELECT 1'" + "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P Password_123 -q 'SELECT 1'" ).withStartupTimeout(20000) ) ) From a684c9f0490d20f5685201e10fcd903c64116170 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 26 Feb 2025 16:09:14 +0000 Subject: [PATCH 10/10] Fix self-signed cert error in tests. --- .github/workflows/budibase_ci.yml | 1 - packages/server/src/integrations/tests/utils/mssql.ts | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 91c32359d2..2e7851b338 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -235,7 +235,6 @@ jobs: - name: Test server env: DATASOURCE: ${{ matrix.datasource }} - DEBUG: testcontainers* run: | if ${{ env.ONLY_AFFECTED_TASKS }}; then AFFECTED=$(yarn --silent nx show projects --affected -t test --base=${{ env.NX_BASE_BRANCH }} -p @budibase/server) diff --git a/packages/server/src/integrations/tests/utils/mssql.ts b/packages/server/src/integrations/tests/utils/mssql.ts index d84fb5d12d..453c2b8bc8 100644 --- a/packages/server/src/integrations/tests/utils/mssql.ts +++ b/packages/server/src/integrations/tests/utils/mssql.ts @@ -23,7 +23,7 @@ export async function getDatasource(): Promise { }) .withWaitStrategy( Wait.forSuccessfulCommand( - "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P Password_123 -q 'SELECT 1'" + "/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P Password_123 -q 'SELECT 1'" ).withStartupTimeout(20000) ) ) @@ -44,7 +44,8 @@ export async function getDatasource(): Promise { user: "sa", password: "Password_123", options: { - encrypt: false, + encrypt: true, + trustServerCertificate: true, }, }, }