Pricing Blog

Supabase PATCH not Working Outside of Editor

  • _.__._.__.__._-1413493397972320326

    Ethan

    8 days ago

    Hi all,

    I've begun testing my app outside of the editor, but I have run into an issue. I have a page with a post and a patch API call. The page functions as intended when tested inside of the editor, but not when in a separate tab.

    The POST API works both inside and outside of the editor, but when the PATCH API is called, the following is returned:
    Object { error: "NetworkError when attempting to fetch resource.", status: undefined }

    I'm not sure as to why this is happening, Is there something special I am supposed to do for PATCH calls?
    1
  • erikbeus-1413494506170618007

    Erik Beuschau

    8 days ago

    Is it a proxied API request?
  • _.__._.__.__._-1413494704594489455

    Ethan

    8 days ago

    Yes
  • erikbeus-1413495466062254111

    Erik Beuschau

    8 days ago

    Could you compare the request made in the editor vs. outside of the editor? Ideally by looking at your network tab and copying the request to curl or similar?
  • _.__._.__.__._-1413497140637990963

    Ethan

    8 days ago

    curl.exe ^"https://start-processflow360.toddle.site/.toddle/omvej/components/Track^%^20Order/apis/Track^%^20Order:tasks-patch^" ^
    --compressed ^
    -X PATCH ^
    -H ^"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0) Gecko/20100101 Firefox/142.0^" ^
    -H ^"Accept: /^" ^
    -H ^"Accept-Language: en-US,en;q=0.5^" ^
    -H ^"Accept-Encoding: gzip, deflate, br, zstd^" ^
    -H ^"Referer: https://start-processflow360.toddle.site/_toddle/preview^" ^
    -H ^"apikey: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imlnb3N4bmVrYnpzcHFmaG13bnpuIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTQ5ODQ1NjMsImV4cCI6MjA3MDU2MDU2M30.xzQzVHb1y3crT1xqKXPVzWoc6QSKkfEhCQ4GIP_d-ds^" ^
    -H ^"authorization: Bearer ^{^{ cookies.access_token ^}^}^" ^
    -H ^"content-type: application/json^" ^
    -H ^"prefer: return=representation^" ^
    -H ^"x-nordcraft-url: https://igosxnekbzspqfhmwnzn.supabase.co/rest/v1/tasks?task_id=eq.2a5c2e5a-1949-4503-bd18-6d28656e9407^" ^
    -H ^"Origin: https://start-processflow360.toddle.site^" ^
    -H ^"Sec-GPC: 1^" ^
    -H ^"Connection: keep-alive^" ^
    -H ^"Sec-Fetch-Dest: empty^" ^
    -H ^"Sec-Fetch-Mode: cors^" ^
    -H ^"Sec-Fetch-Site: same-origin^" ^
    -H ^"Cookie: refresh_token=w6pjjnvov2f6 ;access_token=<<redacted>>^" ^
    -H ^"Priority: u=4^" ^
    -H ^"TE: trailers^" ^
    --data-raw ^"^{^^"status^^":^^"In Progress^^"^}^"
  • _.__._.__.__._-1413497433853395148

    Ethan

    8 days ago

    This is the one in the app.

    The one outside of the app doesn't even exist, its just
    1413497433589026876-image.png
  • erikbeus-1413499417251811328

    Erik Beuschau

    8 days ago

    Is it a component that you have exported as a web component?
  • _.__._.__.__._-1413500255437328395

    Ethan

    8 days ago

    I think so?

    Its being called when my form component's submit event is triggered. my form component <pf-form> is a wrapper on a normal form that builds it dynamically from a JSON schema
  • erikbeus-1413500479081811979

    Erik Beuschau

    8 days ago

    Let me rephrase: when you say it doesn't work "outside of the editor". Which url are you visiting where it doesn't work?
  • _.__._.__.__._-1413501393825824840

    Ethan

    8 days ago

    Oh wait, I think I've spotted the issue. After my request my is made, the page is reloaded to refresh the tables
  • erikbeus-1413501400750751876

    Erik Beuschau

    8 days ago

    Alright, so it's on a Nordcraft url 👍 I was just curious if you were embedding a component in a different environment/framework somewhere.
  • _.__._.__.__._-1413501468786557058

    Ethan

    8 days ago

    which is cancelling the request (NS_BINDING_ABORTED).
  • Redirects don't happen in the editor so its not an issue
  • erikbeus-1413501561723945114

    Erik Beuschau

    8 days ago

    Right. We do cancel network requests if a component/page is no longer supposed to be rendered
  • _.__._.__.__._-1413501618053447680

    Ethan

    8 days ago

    okay, time for a new solution ig
    🙌1
  • erikbeus-1413501716514476224

    Erik Beuschau

    8 days ago

    I noticed the (client side) redirect. It's also possible to perform server side redirects in the Advanced section of your API request btw 👍
  • _.__._.__.__._-1413501866423091264

    Ethan

    8 days ago

    Thanks
    👍1