warflash
warflash
Explore posts from servers
CDCloudflare Developers
Created by warflash on 8/22/2024 in #general-help
Cache Rules don't work when origin Cache-Control is set
No description
16 replies
TtRPC
Created by warflash on 6/1/2024 in #❓-help
How to prevent leaking error messages to client?
No description
4 replies
DTDrizzle Team
Created by warflash on 5/6/2024 in #help
`null` is not assignable to nullable string column?
No description
3 replies
TtRPC
Created by warflash on 4/8/2024 in #❓-help
Middleware context changes aren't applied to `responseMeta(opts)` options
In our middleware I extend the ctx like this:
const public = t.middleware(async ({ next, ctx }) => {
return next({
ctx: {
enableCache: true,
},
})
})
const public = t.middleware(async ({ next, ctx }) => {
return next({
ctx: {
enableCache: true,
},
})
})
and then in the api handler where I'd like to add cache headers in the reponseMeta function I try accessing ctx. However it hasn't been modified there and returns an empty object. Accessing ctx in my router procedure itself properly returns the right context.
export default trpcNext.createNextApiHandler({
router: appRouter,
createContext,
responseMeta(opts) {
console.log(opts);
return {};
},
});
export default trpcNext.createNextApiHandler({
router: appRouter,
createContext,
responseMeta(opts) {
console.log(opts);
return {};
},
});
Any idea on how I can get this to work? Thank you!
2 replies
DTDrizzle Team
Created by warflash on 2/9/2024 in #help
Custom Logic in Upsert/Insert on conflict
Hey everyone! I'm looking for ideas on how the following could be implemented using drizzle:
INSERT INTO my_table (id, language, name, data, updated_at)
VALUES ($1, $2, $3, $4, NOW())
ON CONFLICT (id, language) DO UPDATE
SET
name = EXCLUDED.name,
data = EXCLUDED.data,
updated_at = CASE
WHEN (my_table.name IS DISTINCT FROM EXCLUDED.name OR
my_table.data IS DISTINCT FROM EXCLUDED.data) THEN NOW()
ELSE my_table.updated_at
END
WHERE my_table.name IS DISTINCT FROM EXCLUDED.name OR
my_table.data IS DISTINCT FROM EXCLUDED.data;
INSERT INTO my_table (id, language, name, data, updated_at)
VALUES ($1, $2, $3, $4, NOW())
ON CONFLICT (id, language) DO UPDATE
SET
name = EXCLUDED.name,
data = EXCLUDED.data,
updated_at = CASE
WHEN (my_table.name IS DISTINCT FROM EXCLUDED.name OR
my_table.data IS DISTINCT FROM EXCLUDED.data) THEN NOW()
ELSE my_table.updated_at
END
WHERE my_table.name IS DISTINCT FROM EXCLUDED.name OR
my_table.data IS DISTINCT FROM EXCLUDED.data;
I need to check whether the inserted data differs to the existing data by comparing them using IS DISTINCT FROM. Appreciate any suggestion with how that could be done using insert().values().onConflictDoUpdate() that drizzle provides. Thanks!
3 replies
CDCloudflare Developers
Created by warflash on 11/7/2023 in #pages-help
Warning(s) when compiling Worker
Hey, trying to deploy my nuxt 3 app to cf pages. The build goes through but in the upload step cloudflare logs : ▲ [WARNING] 2 warning(s) when compiling Worker. The build finishes successfully but accessing the pages preview url results in a 404. Is there any way for me to check what those warnings are that have been found? I'm hoping to find the reason for the 404 there but nothing is logged to the build console
1 replies
NNuxt
Created by warflash on 7/7/2023 in #❓・help
Broken Plugin Types
No description
11 replies
DTDrizzle Team
Created by warflash on 6/10/2023 in #help
Custom Function to Transform Subqueries is missing types
👋 So I am trying to write helper functions that are able to transform subqueries. The goal is to work around not having access either RPC's nor subqueries in select statements. A bit more context in this discussion: https://discord.com/channels/1043890932593987624/1085153354340114563/1116875363193192470 However using something like
function transformWithSubquery<T extends WithSubqueryWithSelection<ColumnsSelection, string>>(subquery: T) {
// do magic things
function transformWithSubquery<T extends WithSubqueryWithSelection<ColumnsSelection, string>>(subquery: T) {
// do magic things
doesn't seem to do the trick to actually work with subqueries as the types are hidden from what I can tell: https://github.com/drizzle-team/drizzle-orm/blob/1c9d63bd689e6b8b6a6abf3db1ec32ab6cf179ac/drizzle-orm/src/subquery.ts#L9 Would appreciate any insight, I've been stuck with this for the entire week now and it's starting to block a lot of other things on the team - thank you!
1 replies
DTDrizzle Team
Created by warflash on 5/5/2023 in #help
TS query types dont match + no return types
7 replies
DTDrizzle Team
Created by warflash on 5/3/2023 in #help
Tables are not being generated
6 replies
NNuxt
Created by warflash on 3/31/2023 in #❓・help
Distinct entry js files for certain routes
Wondering if someone has an idea on how to generate different entry files for certain routes. I have a route that is specifically only used to be embedded as an tooltip/iframe but the entry file ships with all of the js used on other routes as well.
1 replies
NNuxt
Created by warflash on 1/5/2023 in #❓・help
How to Minimal JS + prevent preloads
Hey, we have a route that's only used to be embedded in other sites using an iframe with no interactivity at all. Is there a way to disable js preloading etc. for certain routes only? We want to avoid loading and mounting our entire app when all that's needed and visible is one component. Here is an example of what it should look like: https://bdolytics.com/en/EU/tooltip/item/721003 If you check the dev-tools it loads a ton of files while the server rendered html + fonts + simple logic onMounted() would be plenty. Appreciate any insight!
1 replies