October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Shenzhen desk4 min

How I Fixed OptiQ’s Database Persistence Problem on Tencent EdgeOne Makers

A local SQLite file was not dependable shared storage for OptiQ’s edge function. Here’s why its creator moved to a managed database and used a nullable foreign key for sales without prescriptions.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

OptiQ’s database plan looked simple: keep a SQLite file beside the app and let the edge function use it. That assumption nearly shipped a broken sales-tracking app. Harry Agustiana’s fix was to connect the function to a managed database over HTTP, and to make a prescription relationship optional in the schema where the business rules allowed it.

Why did the database work locally but become risky after deployment?

A local SQLite file can persist on a traditional server with a durable disk. An edge function is different: requests may run in isolated instances, and a later request is not guaranteed to reach the same one. A database file written in one instance is therefore not automatically durable or shared with the next.

As an Amazon Associate I earn from qualifying purchases.

In his account of building OptiQ, a sales-tracking app for small optical shops, Harry Agustiana describes the risk plainly: “A .db file written on one request could be gone — or inconsistent — by the next.” That is his explanation of the deployment problem he encountered, not an independently reproduced incident. Read Agustiana’s account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The issue is not that SQLite is inherently unsuitable. It is that a file inside an application or temporary execution environment is not a reliable shared database unless the platform explicitly provides durable, coordinated storage for it. The app needed a storage system that could serve requests regardless of which edge instance handled them.

What did OptiQ need its database to represent?

The app tracked several kinds of shop sales: frames, lenses, complete pairs, soft contact lenses, and accessories. Refraction data could belong to a customer and sometimes relate to a sale, but not every sale involved a prescription.

That domain detail mattered both to the storage choice and to the schema. The data was relational, and the app needed joins, constraints, and aggregate queries. A key-value store could hold records, but the author anticipated having to build indexes and aggregate results in application code for the app’s access patterns.

Rank #2
Sale
SQL Server Hardware
  • Used Book in Good Condition

How did the storage options compare for this app?

Agustiana considered three approaches. The comparison below reflects his evaluation in the article; it is not a current feature, pricing, or performance comparison of the services.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Option What the author considered Trade-off for OptiQ
EdgeOne native KV A fast, simple key-value option The app’s relational queries and aggregates would require more indexing and application-side logic.
Supabase Managed Postgres with a free tier The author says he read that free projects paused after about seven days of inactivity and required manual restoration. That was his plan evaluation at the time, not a verified statement of current terms.
Turso Managed SQLite/libSQL accessed over HTTP The author reports choosing it because remote access fit the edge-function environment while retaining the relational features he wanted.

The practical decision was to match the persistence model and query needs to the execution environment. In this case, a remote database connection fit better than relying on a local file; the need for relational operations made a database with SQL capabilities a better fit than a simple key-value structure, in the author’s judgment. Agustiana’s article describes the selection and its rationale.

What fixed the optional prescription relationship?

OptiQ’s transactions used a nullable refraction_id foreign key. A sale of lens-cleaning solution, for example, could exist without a prescription record. The schema could represent that directly, rather than inserting a fake prescription or splitting sales into separate transaction tables.

The general modeling lesson is narrow but useful: when a relationship is genuinely optional in the real domain, make it optional in the data model. A nullable foreign key still needs appropriate integrity rules, input validation, and query handling; it is not a substitute for deciding what records the application should permit.

How can you tell a persistence problem from a deployment problem?

Not every failure after deployment points to the database. EdgeOne Makers documentation distinguishes Preview and Production environments, each associated with its own branch, domain, and environment variables. The build guide also says that changing environment variables does not alter earlier deployments; the change applies to new deployments. If a database URL or credential was corrected but the existing deployment still behaves the same way, confirm that a new deployment has been created. EdgeOne Makers documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Deployment status and build logs help isolate failures that occur before the function reaches the database. Tencent’s deployment documentation describes deployment states, targets, and build-log retrieval; a successful deployment can return a Preview URL. Deployment documentation.

  • Suspect the persistence design if writes appear to succeed but are missing or inconsistent across later requests or instances.
  • Check environment configuration if the function cannot connect, credentials differ between Preview and Production, or a fix has not reached a newly created deployment.
  • Check the build and output configuration if deployment fails before the app or function can run.

Tencent’s troubleshooting guide lists a 5 GiB account storage capacity limit and a 20,000-file per-project limit; the page does not state a publication year. These are separate platform limits, not an explanation for the local-database persistence risk. The guide also recommends checking the configured output directory and running a local build to locate the generated artifacts when that directory is missing, empty, or invalid. Troubleshooting guide.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What should you take from Agustiana’s fix?

  • Do not treat a file bundled with an edge-function app as durable, shared database storage unless the platform specifically guarantees that behavior.
  • Choose storage around both the runtime and the app’s data access patterns: relations, constraints, joins, and aggregates may make a relational database more suitable than key-value storage.
  • Represent optional relationships as optional when the underlying business rules permit it, and enforce the rest of the integrity rules deliberately.
  • Debug the persistence model separately from environment variables, build output, and deployment status.

EdgeOne Makers is described by Tencent Cloud as a frontend development and deployment platform built on EdgeOne infrastructure, with Preview available to validate changes separately from Production. That separation can help verify a new configuration without confusing a deployment check with a database architecture decision. Tencent Cloud platform overview.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.