question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

500 error upon deployment of a Supabase subscription to Cloudflare Pages

See original GitHub issue

Bug report

Describe the bug

I have a SvelteKit app that uses the ‘@sveltejs/adapter-cloudflare’ adapter to deploy to Cloudflare Pages.

The app uses the @supabase/supabase-js library to connect to my Supabase project. I’ve deployed an app with data reading & writing successfully to Supabase.

I’ve added a basic supabase subscription, and having deployed the change I get the following error on page load:

500 Cannot assign to read only property ‘stack’ of object ‘’ TypeError: Cannot assign to read only property ‘stack’ of object ‘’

The subscription works correctly in local development, but fails when deployed.

Here is the code snippet that causes the failure:

const steps = readable(null, (set) => {
        supabase
            .from('steps')
            .select('*')
            .order('created_at')
            .then(({error, data}) => set(data))

        /* Code above here deploys successfully. Code below does not. */

        const subscrption = supabase
            .from('steps')
            .on('*', (payload) => {
                if (payload.eventType === 'INSERT') {
                    set([...get(steps), payload.new])
                }
            })
            .subscribe()
        return () => supabase.removeSubscription(subscrption)
    })

System information

  • OS: Windows
  • Browser (if applies): Chrome
  • Version of supabase-js: 1.35.4
  • Version of Node.js: 16

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
w3b6x9commented, Jul 4, 2022

@craigdrayton gotcha, i’ll close this issue for now but feel free to re-open if you’re hunch regarding CF adapter doesn’t work out.

1reaction
craigdraytoncommented, Jul 4, 2022

Well color me confused, when I do nothing other than add a try/catch block around the subscription, the 500 error stops occurring, but also the subscription works!?

const steps = readable(null, (set) => {
        supabase
            .from('steps')
            .select('*')
            .order('created_at')
            .then(({error, data}) => set(data))

        try {
            const subscrption = supabase
            .from('steps')
            .on('INSERT', (payload) => {
                set([...get(steps), payload.new])
            })
            .subscribe()

            return () => supabase.removeSubscription(subscrption)
        } catch(e) {
            console.log(e)
        }
    })
Read more comments on GitHub >

github_iconTop Results From Across the Web

500 error when deploying SvelteKit app to pages
When deploying my SvelteKit app to Cloudflare Pages, it builds without issue but navigating to the site shows my navbar and footer, ...
Read more >
Community Tip - Fixing Error 500: Internal Server Error
My site stops working when I enable cloudflare? 500 Errors. Community Tip - All Published Tips. Error 500 & White blank page just...
Read more >
Getting 500 error when trying to buy page rules - Billing
I tried to buy more page rules but I get an error warning that reads: Status: 500, message: failed calling backend for creting...
Read more >
Site gets internal server error 500 message - DNS & Network
hi, one of my site that has been working fine for a long time suddenly get a 500 internal server error message, when...
Read more >
500 Internal Server Error for all CF sites - #43 by KianNH
Hi community. I am getting 520 error while loading my site… usually when using a VPN to access it from another country. Anyone...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found