dub icon indicating copy to clipboard operation
dub copied to clipboard

How to set up tinybird pipes & endpoints ?

Open Revincx opened this issue 2 years ago • 5 comments

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 ?

Revincx avatar Feb 06 '23 09:02 Revincx

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!

steven-tey avatar Feb 20 '23 03:02 steven-tey

sample in .env

TINYBIRD_API_KEY='p.eyJ1IjogIjk2N2MzNmJmLTRjM2QtNDQ2Yy1iM2EzLWEyMGZkMGNkYTFhMCIsICJpZCI6ICI0YTVkMzcyMi0zNzg5LTRjYTUtYTI2MC1jN2ZmMDU4YWNkNTEifQ.3b_8TNcB1O****************************' TINYBIRD_ENDPOINTS='https://api.us-east.tinybird.co/v0/events?name=events_example'

vinagroup avatar Mar 20 '23 18:03 vinagroup

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 avatar Apr 13 '23 15:04 p-rk

@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!

steven-tey avatar May 28 '23 17:05 steven-tey

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.

tomy0000000 avatar Jun 11 '23 07:06 tomy0000000

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. 截圖 2023-07-05 下午2 13 50

peter6055 avatar Jul 05 '23 04:07 peter6055

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!

steven-tey avatar Dec 18 '23 04:12 steven-tey