Gold240sx
Gold240sx
Explore posts from servers
XXata
Created by Gold240sx on 5/31/2024 in #help
Stripe / Payload CMS integration...
I'm trying to configure a next.js project with both Stripe and Payload. Stripe needs access to table header columns id. If i do Postgres, it forces a header column name of xata_id. Payload requires a Postgres enabled DB. I've gotten a schema to work perfectly via Neon, but I'm trying to use Xata as my db. I've gotten past all the "malformed schema file" issues and now it's just giving me one of two errors. Either the migration errors out or theres a runtime error when requesting data from Payload. I'm initiating brand new DB's as such:
npx xata init --schema=./schema.template.json --force
npx xata init --schema=./schema.template.json --force
When I try to apply the above migration into the xata main branch, it says:
"Do you want to apply the above migration into the main branch? … yes
Error: this endpoint works only with non
postgres enabled branches" ...
"Do you want to apply the above migration into the main branch? … yes
Error: this endpoint works only with non
postgres enabled branches" ...
So I Changed the colums with id to xata_id and set up a db with Postgres set to false. The migration worked flawlessly, but there is now error when i run the app and it pulls data from Payload.
"./src/app/payloadContent/pages/blogs/RecentBlogPosts.tsx
Error:
× Label postgresql is already declared
╭─[/Users/michaelmartell/Documents/CODE/Web/2024 Projects/2024-portfolio-xata/payload-next-frontend/src/app/payloadContent/pages/blogs/RecentBlogPosts.tsx:55:1]
55 │ )
56 │ }
57 │
58 │ postgresql: postgresql: export default RecentBlogPosts
· ──────────
╰────
"./src/app/payloadContent/pages/blogs/RecentBlogPosts.tsx
Error:
× Label postgresql is already declared
╭─[/Users/michaelmartell/Documents/CODE/Web/2024 Projects/2024-portfolio-xata/payload-next-frontend/src/app/payloadContent/pages/blogs/RecentBlogPosts.tsx:55:1]
55 │ )
56 │ }
57 │
58 │ postgresql: postgresql: export default RecentBlogPosts
· ──────────
╰────
Below is the Schema file. @NiCK (My friend)
12 replies
XXata
Created by Gold240sx on 4/3/2024 in #help
Xata Starter Guide Next.JS trouble
Just following allong with the Getting Started with Next.js and Xata guide and I'm getting this error:
"npm:@xata.io/client@latest
Module build failed: UnhandledSchemeError: Reading from "npm:@xata.io/client@latest" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "npm:" URIs."
"npm:@xata.io/client@latest
Module build failed: UnhandledSchemeError: Reading from "npm:@xata.io/client@latest" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "npm:" URIs."
on the step where I'm replacing the content in the home page here:
"Next, import the auto-generated getXataClient function from src/xata.ts, get all the posts using the client, and list them within the page:

src/app/page.tsx
import { getXataClient } from '@/xata';
const xata = getXataClient();
export default async function Home() {
const posts = await xata.db.Posts.getAll();
return (
<>
<div className="w-full max-w-5xl mt-16">
{posts.length === 0 && <p>No blog posts found</p>}
{posts.map((post) => ("

"Next, import the auto-generated getXataClient function from src/xata.ts, get all the posts using the client, and list them within the page:

src/app/page.tsx
import { getXataClient } from '@/xata';
const xata = getXataClient();
export default async function Home() {
const posts = await xata.db.Posts.getAll();
return (
<>
<div className="w-full max-w-5xl mt-16">
{posts.length === 0 && <p>No blog posts found</p>}
{posts.map((post) => ("

I'm getting a TS error saying: "Property 'db' does not exist on type 'XataClient'.ts(2339)" and also in my xata.ts file autogenerated, I'm getting the errors: "Cannot find module or its corresponding type declarations." and Cannot find module 'npm:@xata.io/client@latest' or its corresponding type declarations. "
2 replies