Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

91
Views
Pusher working only after refreshing page

I'm implementing pusher in a web application using nextjs. It works as expected in my development environment. But it does not work correctly when I deploy it to vercel. I can only see the results when I refresh the page in the browser.

This is the implementation for the client:

useEffect(() => {

    const pusher = new Pusher(`${process.env.PUSHER_KEY}`, {
        cluster: `${process.env.PUSHER_CLUSTER}`,
        useTLS: true
    });

    const channel = pusher.subscribe('franks-auto-spa');
    channel.bind('cancel-wash', data => {
        console.log(data.date);
        removeWash(data.date);
    });

}, []);

And this is the implementation for the API:

export default async (req, res) => {

    const connection = await mysql.createConnection(process.env.DATABASE_URL);
    console.log(req.body.date);
    const result = await connection.query('DELETE FROM ongoing WHERE date = ?', [req.body.date]);
    console.log(result);

    const pusher = new Pusher({
        appId: `${process.env.PUSHER_ID}`,
        key: `${process.env.PUSHER_KEY}`,
        secret: `${process.env.PUSHER_SECRET}`,
        cluster: `${process.env.PUSHER_CLUSTER}`,
        useTLS: true
    });

    pusher.trigger('franks-auto-spa', 'cancel-wash', req.body);
    res.json({message: 'Wash deleted deleted...'});
}

Am I missing any configuration in Vercel?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!