Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using ‘ilike’ filter: JSON could not be generated #829

Closed
pratham-darooka opened this issue Jun 12, 2024 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@pratham-darooka
Copy link

Bug report

Describe the bug

Trying to run:
response = supabase.table("stocks").select("*").ilike("company_name","%IDEA%").execute().data
but it throws:
Error fetching records from stocks: {'message': 'JSON could not be generated', 'code': 500, 'hint': 'Refer to full message for details', 'details': 'b\'<!DOCTYPE html>\\n<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->\\n<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->\\n<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->\\n<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->\\n<head>\\n<title>Worker threw exception | gkuulctkcukncewrdpgc.supabase.co | Cloudflare</title>\\n<meta charset="UTF-8" />\\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\\n<meta http-equiv="X-UA-Compatible" content="IE=Edge" />\\n<meta name="robots" content="noindex, " />\\n<meta name="viewport" content="width=device-width,initial-scale=1" />\\n<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" />\\n<!--[if lt IE 9]><link rel="stylesheet" id=\\\'cf_styles-ie-css\\\' href="/cdn-cgi/styles/cf.errors.ie.css" /><![endif]-->\\n<style>body{margin:0;padding:0}</style>\\n\\n\\n<!--[if gte IE 10]><!-->\\n<script>\\n if (!navigator.cookieEnabled) {\\n window.addEventListener(\\\'DOMContentLoaded\\\', function () {\\n var cookieEl = document.getElementById(\\\'cookie-alert\\\');\\n cookieEl.style.display = \\\'block\\\';\\n })\\n }\\n</script>\\n<!--<![endif]-->\\n\\n\\n</head>\\n<body>\\n <div id="cf-wrapper">\\n <div class="cf-alert cf-alert-error cf-cookie-error" id="cookie-alert" data-translate="enable_cookies">Please enable cookies.</div>\\n <div id="cf-error-details" class="cf-error-details-wrapper">\\n <div class="cf-wrapper cf-header cf-error-overview">\\n <h1>\\n <span class="cf-error-type" data-translate="error">Error</span>\\n <span class="cf-error-code">1101</span>\\n <small class="heading-ray-id">Ray ID: 8929b827ebb448f2 &bull; 2024-06-12 12:07:13 UTC</small>\\n </h1>\\n <h2 class="cf-subheadline" data-translate="error_desc">Worker threw exception</h2>\\n </div><!-- /.header -->\\n\\n <section></section><!-- spacer -->\\n\\n <div class="cf-section cf-wrapper">\\n <div class="cf-columns two">\\n <div class="cf-column">\\n <h2 data-translate="what_happened">What happened?</h2>\\n <p>You\\\'ve requested a page on a website (gkuulctkcukncewrdpgc.supabase.co) that is on the <a href="https://www.cloudflare.com/5xx-error-landing/" target="_blank">Cloudflare</a> network. An unknown error occurred while rendering the page.</p>\\n </div>\\n\\n \\n <div class="cf-column">\\n <h2 data-translate="what_can_i_do">What can I do?</h2>\\n <p><strong>If you are the owner of this website:</strong><br />you should <a href="https://www.cloudflare.com/login?utm_source=error_100x" target="_blank">login to Cloudflare</a> and check the error logs for gkuulctkcukncewrdpgc.supabase.co.</p>\\n </div>\\n \\n </div>\\n </div><!-- /.section -->\\n\\n <div class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">\\n <p class="text-13">\\n <span class="cf-footer-item sm:block sm:mb-1">Cloudflare Ray ID: <strong class="font-semibold">8929b827ebb448f2</strong></span>\\n <span class="cf-footer-separator sm:hidden">&bull;</span>\\n <span id="cf-footer-item-ip" class="cf-footer-item hidden sm:block sm:mb-1">\\n Your IP:\\n <button type="button" id="cf-footer-ip-reveal" class="cf-footer-ip-reveal-btn">Click to reveal</button>\\n <span class="hidden" id="cf-footer-ip">206.84.234.242</span>\\n <span class="cf-footer-separator sm:hidden">&bull;</span>\\n </span>\\n <span class="cf-footer-item sm:block sm:mb-1"><span>Performance &amp; security by</span> <a rel="noopener noreferrer" href="https://www.cloudflare.com/5xx-error-landing" id="brand_link" target="_blank">Cloudflare</a></span>\\n \\n </p>\\n <script>(function(){function d(){var b=a.getElementById("cf-footer-item-ip"),c=a.getElementById("cf-footer-ip-reveal");b&&"classList"in b&&(b.classList.remove("hidden"),c.addEventListener("click",function(){c.classList.add("hidden");a.getElementById("cf-footer-ip").classList.remove("hidden")}))}var a=document;document.addEventListener&&a.addEventListener("DOMContentLoaded",d)})();</script>\\n</div><!-- /.error-footer -->\\n\\n\\n </div><!-- /#cf-error-details -->\\n </div><!-- /#cf-wrapper -->\\n\\n <script>\\n window._cf_translation = {};\\n \\n \\n</script>\\n\\n</body>\\n</html>\\n\''}

Expected behavior

Should run with filter.

Stack Trace

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/postgrest/_sync/request_builder.py](https://em3atjnxot6-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20240610-060201_RC00_641853629#) in execute(self)
     77             else:
---> 78                 raise APIError(r.json())
     79         except ValidationError as e:

5 frames
JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

APIError                                  Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/postgrest/_sync/request_builder.py](https://em3atjnxot6-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20240610-060201_RC00_641853629#) in execute(self)
     80             raise APIError(r.json()) from e
     81         except JSONDecodeError:
---> 82             raise APIError(generate_default_error_message(r))
     83 
     84
@pratham-darooka pratham-darooka added the bug Something isn't working label Jun 12, 2024
@pratham-darooka pratham-darooka changed the title Error using ‘ilike' filter Error using ‘ilike’ filter: JSON could not be generated Jun 12, 2024
@pratham-darooka
Copy link
Author

Solution from previous issues: use ‘*’ instead of ‘%’ in the filter tuple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant