Adam Harris
Adam Harris
Explore posts from servers
DDeno
Created by Adam Harris on 9/26/2024 in #help
In a deno/npm hybrid monorepo, what are the options for importing a deno member from a npm member?
@dsherret - thanks very much for this!
3 replies
XXata
Created by Adam Harris on 9/4/2024 in #help
Problems setting up Drizzle ORM with HTTP client via client/cli@ne
@tsg thanks for the confirmation - it seems that the generated xata.ts was pointing to a previous (next) version of the @Xata.io/client. So when I followed your instructions (in addition to clearing out the node_modules) the type error has gone away. thanks again for your help! 👍
12 replies
XXata
Created by Adam Harris on 9/4/2024 in #help
Problems setting up Drizzle ORM with HTTP client via client/cli@ne
@tsg basically, even with the @xata/io/client@next version in the package.json, we're still getting errors of the form ts: '"@xata.io/client"' has no exported member named 'getDeployPreviewBranch'. Did you mean 'getPreviewBranch'? in xata.ts
12 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 @tsg just wondering if there has been any progress with this (or eg do you have a github issue that I can watch) ? We just switched to using pnpm in our monorepo and the issue has come back. We are currently stuck until this is fixed... Our package.json looks like this:
"@xata.io/cli": "^0.0.0-next.veed33633c02b9411aecf8f69d8c94071c9257c12",
"@xata.io/client": "^0.0.0-next.veed33633c02b9411aecf8f69d8c94071c9257c12"
"@xata.io/cli": "^0.0.0-next.veed33633c02b9411aecf8f69d8c94071c9257c12",
"@xata.io/client": "^0.0.0-next.veed33633c02b9411aecf8f69d8c94071c9257c12"
12 replies
XXata
Created by Adam Harris on 9/6/2024 in #help
⨯ FetcherError: dbname: invalid branch name when using client@next ts sdk
@tsg yes, that was it - thank you!
11 replies
XXata
Created by Adam Harris on 9/6/2024 in #help
Xata internal postgres fields - can I rely on them?
ok, that's promising!, but I'm still stuck with an invalid branch name error (https://discord.com/channels/996791218879086662/1281543310753927270), so I can't check, unfortunately...
8 replies
XXata
Created by Adam Harris on 9/6/2024 in #help
⨯ FetcherError: dbname: invalid branch name when using client@next ts sdk
@emily how do I check if postgres is enabled on a branch? I definitely enabled it when I initially created the db, but since then I created a new dev branch to rule out a bug due to a branch name containing hyphens. Now I can't see any flags in the UI indicating whether postgres is enabled...
11 replies
XXata
Created by Adam Harris on 9/6/2024 in #help
⨯ FetcherError: dbname: invalid branch name when using client@next ts sdk
Hi @emily thanks for the response. I'm instantiating the client via:
import { XataClient } from "@/xata";

let instance: XataClient | undefined = undefined;

// Seems to fix a bug in the xata client where apiKey and branch are not set
export const getXataClient = () => {
if (instance) return instance;
const apiKey = process.env.XATA_API_KEY;
if (!apiKey) {
throw new Error("XATA_API_KEY not set");
}
const branch = process.env.XATA_BRANCH;
if (!branch) {

throw new Error("XATA_BRANCH not set");
}
const databaseURL = process.env.XATA_DATABASE_URL;
if (!databaseURL) {

throw new Error("XATA_DATABASE_URL not set");
}
instance = new XataClient({
apiKey,
branch,
databaseURL,
});
return instance;
};
import { XataClient } from "@/xata";

let instance: XataClient | undefined = undefined;

// Seems to fix a bug in the xata client where apiKey and branch are not set
export const getXataClient = () => {
if (instance) return instance;
const apiKey = process.env.XATA_API_KEY;
if (!apiKey) {
throw new Error("XATA_API_KEY not set");
}
const branch = process.env.XATA_BRANCH;
if (!branch) {

throw new Error("XATA_BRANCH not set");
}
const databaseURL = process.env.XATA_DATABASE_URL;
if (!databaseURL) {

throw new Error("XATA_DATABASE_URL not set");
}
instance = new XataClient({
apiKey,
branch,
databaseURL,
});
return instance;
};
and accessing the data via a data access layer in a nextjs app. Here is the fn in the data access layer:
import { getXataClient } from "@/data/helpers";
import { TenantsRecord } from "@/xata";
import { SelectedPick } from "@xata.io/client";

const xata = getXataClient();

export async function getTenantBySlug(
slug: string
): Promise<SelectedPick<TenantsRecord, ["*"]> | null> {
const result = await xata.db.tenants.filter({ slug }).getFirst();
return result;
}
import { getXataClient } from "@/data/helpers";
import { TenantsRecord } from "@/xata";
import { SelectedPick } from "@xata.io/client";

const xata = getXataClient();

export async function getTenantBySlug(
slug: string
): Promise<SelectedPick<TenantsRecord, ["*"]> | null> {
const result = await xata.db.tenants.filter({ slug }).getFirst();
return result;
}
11 replies
XXata
Created by Adam Harris on 9/4/2024 in #help
Problems setting up Drizzle ORM with HTTP client via client/cli@ne
@tsg great - that’s what I resorted to, thanks very much for the clarification!
12 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 @tsg thanks very much for your quick response! I followed your steps and this does result in having the correctly installed @next sdk, and the generated xata.ts now has no import errors. However the generated xata.ts still doesn't define getXataClient... Do you have a suggested workaround for this?
12 replies
CCConvex Community
Created by Adam Harris on 8/24/2024 in #support-community
How to count a large set of results from a query?
Thanks very much for the detailed explanation. Yes it’s option 2 that we’re trying to figure out and from reading around other posts on the discord we were thinking we might need to push the data to somewhere like ClickHouse, but it’s great to have the confirmation here - thanks again
12 replies
CCConvex Community
Created by Adam Harris on 8/24/2024 in #support-community
How to count a large set of results from a query?
Hi @jamwt, thanks for your suggestions! it doesn’t need to be high performance and ideally we need to be able to do this kind of thing ad-hoc for reporting, so keeping counts insertion won’t really work for us here unfortunately. We’re really missing sql-style ad-hoc aggregations at the moment. Can you please expand a bit on your orm-type table wrapper that you mentioned?
12 replies
CCConvex Community
Created by RJ on 7/15/2024 in #support-community
Nested optional search field type error
@sshader sorry - I'm actually using zod validators (and copied over here without thinking much) and then using zodToConvex to make the convex validator, so that syntax is correct for a zod validator and it is being transformed to the correct convex validator. But thank you very much for your suggested workarounds! So it this a tracked issue/bug somewhere, so that I can keep an eye on it?
8 replies
CCConvex Community
Created by RJ on 7/15/2024 in #support-community
Nested optional search field type error
Hi @RJ @sshader I think seeing the same error, but with a standard index. i.e. when I have a schema of the form:
documents: defineTable({
fieldOne: v.string(),
fieldTwo: v.optional(v.object({
subFieldOne: v.string().optional(),
})),
}).index("by_sub_field_one", ["fieldTwo.subFieldOne"]),
documents: defineTable({
fieldOne: v.string(),
fieldTwo: v.optional(v.object({
subFieldOne: v.string().optional(),
})),
}).index("by_sub_field_one", ["fieldTwo.subFieldOne"]),
and I do a query like:
const data = await ctx.db
.query("documents")
.withIndex("by_sub_field_one", (q) =>
q.eq(
"fieldTwo.subFieldOne",
"some string"
// ^ Argument of type '"some string"' is not assignable to parameter of type 'undefined'.
)
)
.collect();
const data = await ctx.db
.query("documents")
.withIndex("by_sub_field_one", (q) =>
q.eq(
"fieldTwo.subFieldOne",
"some string"
// ^ Argument of type '"some string"' is not assignable to parameter of type 'undefined'.
)
)
.collect();
I'm seeing the same error Argument of type '"some string"' is not assignable to parameter of type 'undefined'. Note the extra optional in subFieldOne: v.string().optional(). I expect that this error would still be there if I just had subFieldOne: v.string() but I thought I'd see what the status was before looking into a minimal reproducible example etc... What is the current state of the situation here? Has this been fixed anywhere, or do you have a suggested workaround?
8 replies
CCConvex Community
Created by Adam Harris on 7/24/2024 in #support-community
Issue trying to import csv via Airbyte
Also here are the logs from that failed sync
4 replies
CCConvex Community
Created by Adam Harris on 6/28/2024 in #support-community
Can't import snapshot to dev
@lee that worked thank you! (I misread the error message as there being documents in the table that conflict, rather than there being a table called documents....!)
9 replies
CCConvex Community
Created by RJ on 9/19/2023 in #support-community
Codegen typings break when `exactOptionalPropertyTypes` is true
@RJ thanks for the confirmation! Maybe I'll just stick with Zod schemas for now then, since the integration with zod seems good...
23 replies
CCConvex Community
Created by RJ on 9/19/2023 in #support-community
Codegen typings break when `exactOptionalPropertyTypes` is true
Hi @RJ @ballingt I'm just getting started with convex, looking to use effect-ts schema also and have just come across this issue. Is the recommended workaround still just to keep the exactOptionalPropertyTypes flag set to false?
23 replies