dub
dub copied to clipboard
How to set up tinybird pipes & endpoints ?
I am self-hosting the project now, to make the stats panel works, I registered a tinybird account and set the TINYBIRD_API_KEY envronment variable. But I don't know how to config the tinybird pipes to make the stats api works, could you please show the SQL sentences of the pipe nodes ?
Apologies for this – I realized that I hadn't included any code for that after the Tinybird migration. I'll be documenting the SQL statements soon!
sample in .env
TINYBIRD_API_KEY='p.eyJ1IjogIjk2N2MzNmJmLTRjM2QtNDQ2Yy1iM2EzLWEyMGZkMGNkYTFhMCIsICJpZCI6ICI0YTVkMzcyMi0zNzg5LTRjYTUtYTI2MC1jN2ZmMDU4YWNkNTEifQ.3b_8TNcB1O****************************' TINYBIRD_ENDPOINTS='https://api.us-east.tinybird.co/v0/events?name=events_example'
Apologies for this – I realized that I hadn't included any code for that after the Tinybird migration. I'll be documenting the SQL statements soon!
any update on this ?
@p-rk not yet, sorry! 😓 there are a few other features at the top of the roadmap (e.g. #191, #73) so won't be able to get to this until after that!
I'm seeing this error when deploy, the same issue happened when I tried build on local:
Error occurred prerendering page "/dub.sh". Read more: https://nextjs.org/docs/messages/prerender-error
--
15:01:22.410 | TypeError: Cannot read properties of undefined (reading 'map')
15:01:22.410 | at Globe (/vercel/path0/.next/server/app/dub.sh/page.js:5132:30)
15:01:22.410 | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
15:01:22.546 | - info Generating static pages (38/38)
15:01:22.548 |
15:01:22.549 | > Export encountered errors on following paths:
15:01:22.549 | /dub.sh/metatags/page: /dub.sh/metatags
15:01:22.549 | /dub.sh/page: /dub.sh
15:01:22.636 | error Command failed with exit code 1.
Here's the snippet where the error occurred:
async function Globe() {
const response = await fetch(`https://api.us-east.tinybird.co/v0/pipes/coordinates.json`, {
headers: {
Authorization: `Bearer ${process.env.TINYBIRD_API_KEY}`
},
next: {
revalidate: 43200
}
}).then((res)=>res.json()).then((res)=>res.data);
const markers = response.map(({ latitude , longitude }, idx)=>{
return {
location: [
latitude,
longitude
],
size: 0.075 - 0.075 / 50 * idx
};
});
return /*#__PURE__*/ jsx_runtime_.jsx(globe_client, {
markers: markers
});
}
which I think points to the Globe
function in app/ui/home/globe.tsx
.
Since we don't have any guide documenting how Tinybird works with dub (my guess is some schema to set up), this is the furthest I can go to self-host the instance for now.
I had re-make the pipes by referencing the dub.sh website and the source code. All you need to do is to import it into Tinybird pipes and set up TINYBIRD_API_KEY on the environmental variables. pipe.zip
However, I got no idea how to make "timeseries" pipes since it seems to require a date/hour generator.
This should be fixed with the new self-hosting guide: https://dub.sh/self-host
Feel free to create a new issue if you run into any other issues – thank you!