Hey @aadtyaraj01,
This goes against our recommended implementation. We would always discourage users from putting two different types in the same route. I would probably make the routing structure:
app/hubspot/integration/zapier
app/hubspot/error/syncing-contacts
However, if that's not an option, there are some potential workarounds.
As you've observed, there is no way to query a document by its type without specifying the UID.
The most obvious workaround in my mind would be to use a try/catch block (untested code):
async function attemptQuery(uid) {
try {
return await client.getByUID("error", uid)
} catch (error) {
null
}
try {
return await client.getByUID("integration", uid)
} catch (error) {
null
}
}
There's probably a better way to structure this so that you can still catch the error message if its an unexpected error, but this might give you some idea as to how to proceed.
What do you think? Would this help with your use case?
Sam