tiernacity
tiernacity
CCConvex Community
Created by tiernacity on 3/21/2024 in #support-community
OCC and retries and errors, oh my
Ok thanks @Michal Srb that's what I was looking for (also, thanks @The Cyberverse)
5 replies
CCConvex Community
Created by fawwaz on 10/24/2023 in #support-community
Trying to implement 404 but getting validator error
Can be used like this:
const { table1, table2 } = castId(ctx, ['table1', 'table2'], id)
if (table1) {
// You have an Id<'table1'> in variable table1, do something with it
}
if (table2) {
// You have an Id<'table2'> in variable table2, do something with it
}
}
const { table1, table2 } = castId(ctx, ['table1', 'table2'], id)
if (table1) {
// You have an Id<'table1'> in variable table1, do something with it
}
if (table2) {
// You have an Id<'table2'> in variable table2, do something with it
}
}
15 replies
CCConvex Community
Created by fawwaz on 10/24/2023 in #support-community
Trying to implement 404 but getting validator error
Stumbled across this thread while trying to work out how to handle an array of IDs, which could belong to more than one table. Taking inspiration from the RLS code in convex-helpers (linked in another thread) I wrote a little helper function to help me determine which table an ID belongs to. Sharing here, in case it's useful to anyone else
import { MutationCtx, QueryCtx } from '../_generated/server'
import { Id, TableNames } from '../_generated/dataModel'

const castId = <T extends TableNames>(
ctx: QueryCtx | MutationCtx,
tables: T[],
id: Id<T> | string,
) => {
return tables.reduce(
(acc, table) => {
return {
...acc,
[table]: ctx.db.normalizeId(table, id),
}
},
{} as { [K in T]: Id<K> | null },
)
}

export { castId }
import { MutationCtx, QueryCtx } from '../_generated/server'
import { Id, TableNames } from '../_generated/dataModel'

const castId = <T extends TableNames>(
ctx: QueryCtx | MutationCtx,
tables: T[],
id: Id<T> | string,
) => {
return tables.reduce(
(acc, table) => {
return {
...acc,
[table]: ctx.db.normalizeId(table, id),
}
},
{} as { [K in T]: Id<K> | null },
)
}

export { castId }
15 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
Tying-up the @react-email/tailwind side of this thread - using external packages in my action was sufficient to get that all working
42 replies
CCConvex Community
Created by Helmet on 11/11/2023 in #support-community
Could not locate the bindings file
Yeah, in fact I spent a while trying out @napi-rs/canvas which has no such dependencies, but couldn't get that to work either (for different reasons). Eventually I decided to give up, and just consume what I need via a third-party API
16 replies
CCConvex Community
Created by Helmet on 11/11/2023 in #support-community
Could not locate the bindings file
I've just bumped up against the same issue (node-gyp wants python) while trying to install https://github.com/Automattic/node-canvas with "externalPackages": ["*"]
16 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
Follow-up: resend is back up and my react-email has sent from a convex action. Thanks for the support and guidance
42 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
Yeah, 13 hours and counting. Someone is having a really bad day 😦
42 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
Ok, thanks guys! A combination of: - adopting your tsconfig.json - moving my email templates from /emails to /convex/emails means that my convex function has deployed now. Unfortunately I can't test it because resend is down today - but it looks promising and I'm unblocked. Shame that the CSS files prevent me from using react-email's tailwind integation - but hey, I can live without that
42 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
I'm following this to install react-email (https://react.email/docs/getting-started/manual-setup) and this to integrate w/ resend (https://react.email/docs/integrations/resend)
42 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
Let me take a longer look at the repo/example you shared, see if I can get me head around that
42 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
I have an file with the action /convex/email.ts. A file with a module that imports the react-email SDK and the email template /convex/emails/new_share.ts. And the template itself /emails/new_share.tsx I've just tried changing all these file extensions to .tsx but I'm still seeing an Unexpected token error.
42 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
I'm not sure from the output. Probably Sorry, yes it's .ts
42 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
Ahh thanks! I'll take a look. Looks like it's their tailwind support that adds the CSS - so I can drop that at least
42 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
This doesn't help (enough) I still get an error
400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Failed to analyze
src/email/new_share.js: Uncaught SyntaxError: Unexpected token '<'
400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Failed to analyze
src/email/new_share.js: Uncaught SyntaxError: Unexpected token '<'
42 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
Yes and I guess my fallback option is to punt this into a next.js API route - then call that from convex
42 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
With no tailwind, convex still doesn't like the TSX
400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Failed to analyze src/email/new_share.js: Uncaught SyntaxError: Unexpected token '<'
400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Failed to analyze src/email/new_share.js: Uncaught SyntaxError: Unexpected token '<'
42 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
Perhaps that + the render utility
42 replies
CCConvex Community
Created by tiernacity on 2/21/2024 in #support-community
Problem integrating react-email into an internal action
Yes, I tried yesterday but no beans. I've just noticed that the .css files disappear if I don't use their tailwind integration - which is progress.
42 replies