David
David
TtRPC
Created by David on 9/11/2024 in #❓-help
How to get line number in errors?
Thank you! Im using Turbopack in Next
8 replies
TtRPC
Created by David on 9/11/2024 in #❓-help
How to get line number in errors?
Im guessing this must be it then, do you have a reference where this is set up correctly that I can compare to? I do have sourceMap: true in tsconfig.
8 replies
TtRPC
Created by David on 6/4/2024 in #❓-help
Best way to get the type of the first argument for .query or .mutation
Maybe its best I just explain what im looking to achieve. For file uploads our current flow is: 1. Get upload token through query 2. Use upload token to upload directly to S3 from browser 3. Call mutation to do something with this finished upload We currently reuse the same logic everywhere for this, but we've gotten to a point where quite often we want to do some type of server-side logic before returning an upload token, or after uploading. So I want to create a function that takes in a couple of arguments to help with this, and returns a router. So we can do something like:
const { upload ] = useUpload(trpc.path.to.specific.upload.router)

// useUpload
const upload = (args) => {
const token = await router.getUploadToken({ args })
// upload to S3
await router.onUploadFinished({ args })
}
const { upload ] = useUpload(trpc.path.to.specific.upload.router)

// useUpload
const upload = (args) => {
const token = await router.getUploadToken({ args })
// upload to S3
await router.onUploadFinished({ args })
}
10 replies
TtRPC
Created by David on 6/4/2024 in #❓-help
Best way to get the type of the first argument for .query or .mutation
Ah, is that only a v11 feature?
10 replies
TtRPC
Created by David on 6/4/2024 in #❓-help
Best way to get the type of the first argument for .query or .mutation
That looks like it can help me get what I need, thanks!
10 replies
TtRPC
Created by David on 6/4/2024 in #❓-help
Best way to get the type of the first argument for .query or .mutation
I want to do something like this:
.input(Zod).query(onUploadComplete(({ input, ctx }) => {
...
})
.input(Zod).query(onUploadComplete(({ input, ctx }) => {
...
})
10 replies
TtRPC
Created by David on 6/4/2024 in #❓-help
Best way to get the type of the first argument for .query or .mutation
That would return just the input, I assume? I want the type for the whole first argument that gets passed, incl context etc if possible
10 replies
TtRPC
Created by David on 11/14/2023 in #❓-help
"fetch failed" when building
This works! Thank you so much! Do you know why this happens during build? And could it be related to the fact that those queries get called in _app , compared to everything else which is only called on a page
25 replies
TtRPC
Created by David on 11/14/2023 in #❓-help
"fetch failed" when building
Will try this now!
25 replies
TtRPC
Created by David on 11/14/2023 in #❓-help
"fetch failed" when building
Changing it to useQuery instead of useSuspenseQuery solves it for now
25 replies
TtRPC
Created by David on 11/14/2023 in #❓-help
"fetch failed" when building
mostly confused because it shouldn't be fetching anything initially
25 replies
TtRPC
Created by David on 11/14/2023 in #❓-help
"fetch failed" when building
So, we reverted the original PR for a while until we had more time to look at it. It starts when you change this:
// blitz way
return useQuery(ActiveLocalesQuery,
// blitz way
return useQuery(ActiveLocalesQuery,
to this:
return trpc.core.companyProduct.getActiveLocales.useSuspenseQuery(undefined, {
return trpc.core.companyProduct.getActiveLocales.useSuspenseQuery(undefined, {
25 replies
TtRPC
Created by David on 11/14/2023 in #❓-help
"fetch failed" when building
So, some observations: The request is happening even before the browser renders, it does not show in the network tab in the browser, there are no cookies attached to the request when logging it on the server side Everything works in the background, as in the browser renders and makes a valid request etc. It does not end up in our root error boundary But any call to that specific procedure causes it. So if I only render that specific query it'll happen, even though I render it as we would anywhere else in some page. Only occurs for this specific procedure, taking out the code it errors on (cookie / auth stuff) fixes it, even though a bunch of other procedures use that same middleware
25 replies
TtRPC
Created by David on 11/14/2023 in #❓-help
"fetch failed" when building
Will try these things, thank you for the responses!
25 replies
TtRPC
Created by David on 11/14/2023 in #❓-help
"fetch failed" when building
We did add prefetching in this commit on a page, but that is inside of a gssp.
25 replies
TtRPC
Created by David on 11/14/2023 in #❓-help
"fetch failed" when building
Have looked through the commit where it started several times, I can't find anything that would cause this. All our fetches/hook calls are inside of components, nothing at the root level. Any idea how I could see a better stack trace that may lead to where its coming from?
25 replies
TtRPC
Created by David on 11/14/2023 in #❓-help
"fetch failed" when building
Appreciate the reply! This is during build though, it shouldn't be trying to fetch anything anyway, so im not sure at what point or why it is attempting to
25 replies
TtRPC
Created by David on 11/14/2023 in #❓-help
"fetch failed" when building
@Alex / KATT 🐱 Sorry, prefer not to tag people but been stuck at this for a while and i've got 0 clue how to continue. Any ideas?
25 replies
TtRPC
Created by David on 11/14/2023 in #❓-help
"fetch failed" when building
We looked through github, this Discord server etc but all the solutions there don't work. Usually people actually want to be fetching as SSR or something but that is not the case with us so we don't understand why it even attempts to fetch something
25 replies
TtRPC
Created by MonkeyStruct on 5/2/2023 in #❓-help
createTRPCNext config ctx always returns undefined.
unfortunate, thanks for replying
5 replies