Hello. I’ve been using Netlify’s Serverless Functions for a blog website for nearly two years. Some of them are used to load comments from a FaunaDB database, whilst another is created automatically during deployment (as I have the Netlify Search Index Plugin installed).
All of these have been working flawlessly, but since mid-February the Netlify functions for FaunaDB have been returning 500 errors, whilst the function for the search plugin now returns a 404. The errors occur 100% of the time.
Obviously something has happened that has affected both entities, so to keep this thread focussed I’d like to concentrate on just the Search Plugin (as it’s a public Netlify plugin, and therefore should be easier to debug compared to my own custom functions).
My account name is
festive-swirles-0f46c8, using a custom domain of
discussion.lttmagazine.co.uk and the search page can be found here (you’ll notice from the browser console logs that it immediately struggles to find the search function, as it returns a 404).
You can see from my build logs below that the Netlify Search Index Plugin installs fine during deployment…
11:28:29 AM: ──────────────────────────────────── 11:28:29 AM: 3. netlify-plugin-search-index (onPostBuild event) 11:28:29 AM: ──────────────────────────────────── 11:28:29 AM: 11:28:31 AM: Search Index JSON generated at /searchIndex.json! 11:28:33 AM: Netlify Function generated at /.netlify/functions/search! 11:28:33 AM: 11:28:33 AM: (netlify-plugin-search-index onPostBuild completed in 3.9s) 11:28:33 AM: 11:28:33 AM: ────────────────────────────────────
As the logs correctly point out, the
searchIndex.json file is created successfully (as can be seen here). But it incorrectly implies that the function has been created inside
/.netlify/functions/search, whereas in reality this path generates a 404 error.
Below is a screenshot from my browser’s console demonstrating this when viewing the search page…
I’ve double checked the generated JSON file to make sure the search plugin is generating it properly and it validates fine. But then I noticed that my serverless functions elsewhere on the website are now generating 500 errors, so I figured there must be something else going on!
The only programmatical change that has occurred recently was to remove a custom domain name
localtransport.today, which basically was a ‘domain alias’. Bearing in mind that it wasn’t the primary domain, could this still potentially be the cause of the issue? Below is how my domains are currently setup…
Default subdomain: festive-swirles-0f46c8.netlify.app Primary domain: discussion.lttmagazine.co.uk
Below you can see the SSL certificate…
Certificate: Let’s Encrypt Domains: discussion.lttmagazine.co.uk Created: May 9, 2020 at 6:09 PM Updated: Feb 20 at 8:48 PM Auto-renews before: May 21 (in 2 months)
It might be a coincidence, but the date of the last SSL certificate renewal (20th Feb 2022) is roughly the same time these problems started occurring. I therefore tried clicking the ‘Renew Certificate’ button, but it never instigates a renewal (and fails silently).
If it helps below is my
netlify.toml file, although it hasn’t been edited for a long time…
[dev] command = "npm run dev" [build] command = "npm run generate" publish = "dist" functions = "functions" [[plugins]] package = 'netlify-plugin-search-index' [plugins.inputs] exclude = ['/sitemap.xml'] [[headers]] for = "/*" [headers.values] Access-Control-Allow-Origin = "*"
I’m at a total loss to work out where to look next. So if anyone has any pointers (or if someone at Netlify is able to take a look at my account) then I’d be eternally grateful. I think I’ve divulged enough information to explain my problem, but if I have missed anything important then please let me know. Thanks everyone!