Adam Harris
Adam Harris
Explore posts from servers
XXata
Created by Adam Harris on 9/6/2024 in #help
⨯ FetcherError: dbname: invalid branch name when using client@next ts sdk
Hi, I'm trying to use Xata with postgres enabled via the @next ts sdk. Firstly, the client generation seems broken, as mentioned in my previous post. But secondly, when I try and make a request I'm getting: ⨯ FetcherError: mydbname: invalid branch name However when I inspect the client config, the config via await xata.getConfig();, correct branch name seems to be present... Any help with this would be much appreciated.
11 replies
XXata
Created by Adam Harris on 9/6/2024 in #help
Xata internal postgres fields - can I rely on them?
Hi, I'm just trying to get started with Xata (with postgres enabled). I chose to use prisma to manage the database schema and db migrations and the xata ts client/sdk for accessing the db. All was going well and I decided to try and set up CI/CD properly, which included checking the xata files out of git and regenerating the client (using a prisma schema as source of truth) in the CI/CD pipeline. However after trying to pin the versions of the client and cli in my package.json and running npx xata codegen, I'm now seeing errors because my records are coming back from the db (via the xata ts client) like this:
{
id: 'rec_bla',
... my fields here
xata_createdat: null,
xata_id: null,
xata_updatedat: null,
xata_version: null,
xata: {
createdAt: 2024-09-04T15:26:12.400Z,
updatedAt: 2024-09-04T15:26:12.400Z,
version: 0
}
}
{
id: 'rec_bla',
... my fields here
xata_createdat: null,
xata_id: null,
xata_updatedat: null,
xata_version: null,
xata: {
createdAt: 2024-09-04T15:26:12.400Z,
updatedAt: 2024-09-04T15:26:12.400Z,
version: 0
}
}
whereas, before they were like this:
{
... my fields here
xata_createdat: 2024-09-04T15:26:12.400Z,
xata_id: 'rec_bla',
xata_updatedat: 2024-09-04T15:26:12.400Z,
xata_version: 0
}
{
... my fields here
xata_createdat: 2024-09-04T15:26:12.400Z,
xata_id: 'rec_bla',
xata_updatedat: 2024-09-04T15:26:12.400Z,
xata_version: 0
}
The errors are happening because I was relying on the xata_id field, but it seems like the xata_id field now needs to be accessed at id and the other xata_ fields are now nested in a xata. path? My guess is that I had the @next version of the client installed and had problems with it, so I installed the @latest, which might have caused this change in the xata fields... Is this the case that the interface for accessing these fields has changed across versions of the client, and shouldn't I be relying on these xata_ postgres fields?
8 replies
XXata
Created by Adam Harris on 9/4/2024 in #help
Problems setting up Drizzle ORM with HTTP client via client/cli@ne
Hi, I'm having some trouble setting up the drizzle ORM with http client. In particular following https://xata.io/docs/integrations/drizzle, I'm running yarn add @xata.io/client@next and I also have the following version of the cli installed: @xata.io/cli/0.0.0-next.v64f10283eb9a098c575590d3ea17600e350321c9 However, when I run xata init, one of the steps is overwriting the xata client version in package.json to "@xata.io/client": "^0.30.0", Then the generated xata.ts has an error:
'"@xata.io/client"' has no exported member named 'getDeployPreviewBranch'. Did you mean 'getPreviewBranch'?`
'"@xata.io/client"' has no exported member named 'getDeployPreviewBranch'. Did you mean 'getPreviewBranch'?`
This error gets fixed if then I reinstall the next version of the xata client, however the generated xata.ts file also doesn't export (or even define) getXataClient, which is required by the setup in the guide https://xata.io/docs/integrations/drizzle, ie. it says:
import { drizzle } from 'drizzle-orm/xata-http';
import { getXataClient } from './xata'; // Generated client

const xata = getXataClient();
const db = drizzle(xata);
import { drizzle } from 'drizzle-orm/xata-http';
import { getXataClient } from './xata'; // Generated client

const xata = getXataClient();
const db = drizzle(xata);
Any help getting xata to work with Drizzle orm would be much appreciated.
12 replies