payload
payload copied to clipboard
payload.db.beginTransaction() not available in payload cloud
Link to reproduction
No response
Describe the Bug
Calling beginTransaction() works well on a local dev server, however fails on payload cloud with
payload_1.default.db.beginTransaction is not a function
To Reproduce
E.g.
const transaction = await payload.db.beginTransaction();
await payload.create(...);
await payload.update(...);
await payload.db.commitTransaction(transaction);
Payload Version
2.11.2
Adapters and Plugins
No response
Can you provide your payload config, especially the db adapter section for troubleshooting?
Sure, here it is, hopefully without anything relevant left out:
import path from "path";
import { payloadCloud } from "@payloadcms/plugin-cloud";
import { mongooseAdapter } from "@payloadcms/db-mongodb";
import { webpackBundler } from "@payloadcms/bundler-webpack";
import { lexicalEditor } from "@payloadcms/richtext-lexical";
import seoPlugin from "@payloadcms/plugin-seo";
import { buildConfig } from "payload/config";
import { Icon } from "./payload-components/Icon";
import Users from "./collections/Users";
import { Logo } from "./payload-components/Logo";
import { Config } from "./payload-types";
declare module "payload" {
export interface GeneratedTypes extends Config {}
}
export default buildConfig({
cors: [
"xxx",
],
csrf: [
"xxx",
],
admin: {
user: Users.slug,
bundler: webpackBundler(),
meta: {
titleSuffix: "- xxx",
favicon: "/assets/icon.svg",
ogImage: "/assets/icon.svg",
},
components: {
graphics: {
Icon,
Logo,
},
},
livePreview: {
breakpoints: [
...
],
},
},
editor: lexicalEditor({}),
localization: {
locales: ["de", "en"],
defaultLocale: "de",
fallback: true,
},
collections: [
xxx
],
globals: [xxx],
plugins: [
payloadCloud(),
seoPlugin({
collections: ["xxx"],
tabbedUI: true,
fieldOverrides: {
title: {
localized: true,
},
description: {
localized: true,
},
},
}),
],
serverURL: process.env.PAYLOAD_PUBLIC_SERVER_URL,
db: mongooseAdapter({
url: process.env.DATABASE_URI,
}),
});
I don't see anything in particular that would cause this type of issue. You could try upgrading to 2.14.2 to see if you still get this error.
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.