{"record":{"id":"bb4fa8267102a529","repo":"tursodatabase/turso","slug":"not-supported","errorCode":"NOT_SUPPORTED","errorMessage":"Sync not supported for remote databases","messagePattern":"Sync not supported for remote databases","errorType":"exception","errorClass":"LibsqlError","httpStatus":null,"severity":"error","filePath":"serverless/javascript/src/compat.ts","lineNumber":506,"sourceCode":"    await this.execLock.acquire();\n    try {\n      if (this._closed) {\n        throw new LibsqlError(\"Client is closed\", \"CLIENT_CLOSED\");\n      }\n\n      await this.session.sequence(sql);\n    } catch (error: any) {\n      if (error instanceof LibsqlError) {\n        throw error;\n      }\n      throw mapDatabaseError(error, \"EXECUTE_MULTIPLE_ERROR\");\n    } finally {\n      this.execLock.release();\n    }\n  }\n\n  async sync(): Promise<any> {\n    throw new LibsqlError(\"Sync not supported for remote databases\", \"NOT_SUPPORTED\");\n  }\n\n  close(): void {\n    this._closed = true;\n    // Note: The libSQL client interface expects synchronous close,\n    // but our underlying session needs async close. We'll fire and forget.\n    this.session.close().catch(error => {\n      console.error('Error closing session:', error);\n    });\n  }\n}\n\n/**\n * Create a libSQL-compatible client for Turso database access.\n * \n * This function provides compatibility with the standard libSQL client API\n * while using the Turso serverless driver under the hood.\n * ","sourceCodeStart":488,"sourceCodeEnd":524,"githubUrl":"https://github.com/tursodatabase/turso/blob/bad083fafbefdeae9a42ec19bdaaad8918dcf411/serverless/javascript/src/compat.ts#L488-L524","documentation":"sync() on the compatibility-layer client always throws a LibsqlError with code NOT_SUPPORTED and the message 'Sync not supported for remote databases'. The compat layer talks to the database over the SQL-over-HTTP protocol against a remote Turso endpoint; embedded-replica sync (pulling a local copy from a sync server) is a local-file client feature that has no equivalent here, so the method exists only to keep API shape parity and rejects unconditionally.","triggerScenarios":"Porting @libsql/client code that used a local file URL with syncUrl/syncInterval and calling await client.sync() against the serverless client. Generic wrapper code that calls sync() on any client it is handed. Feature-detecting by calling sync() inside try/catch.","commonSituations":"Migrating an app from embedded replicas (libsql local file + sync) to pure remote access in serverless/edge runtimes; shared data-layer code that must now branch between local and remote clients.","solutions":["Remove sync() calls — a pure remote client is always current; there is nothing to synchronize","If you need embedded replicas, use a client that supports them (e.g. @libsql/client with a local file: URL) outside serverless runtimes","Branch your data layer on whether sync is available instead of calling it unconditionally","Delete syncUrl/syncInterval config — they are deprecated and rejected by this layer's option validation"],"exampleFix":"// before\nconst client = createClient({ url: process.env.TURSO_URL! });\nawait client.sync(); // NOT_SUPPORTED\n\n// after\nconst client = createClient({ url: process.env.TURSO_URL! });\n// remote client is always current — no sync call needed","handlingStrategy":"fallback","validationCode":"// This client never supports sync(); branch before calling it.\nconst supportsSync = false; // remote serverless client\nif (supportsSync) {\n  await client.sync();\n} else {\n  // remote client is always current — nothing to do\n}","typeGuard":"type SyncCapable = { sync(): Promise<unknown> };\nconst canSync = (c: unknown): c is SyncCapable =>\n  typeof (c as SyncCapable)?.sync === 'function' && !('protocol' in c && (c as any).protocol === 'http');","tryCatchPattern":"try {\n  await client.sync();\n} catch (e) {\n  if (e instanceof LibsqlError && e.code === 'NOT_SUPPORTED') {\n    // Expected on the remote serverless client — skip sync silently\n  } else {\n    throw e;\n  }\n}","preventionTips":["Drop sync() calls when moving from embedded replicas to the remote serverless client","Delete deprecated syncUrl/syncInterval options — this layer rejects them as UNSUPPORTED_CONFIG","Branch your data layer on client type instead of calling sync() unconditionally","Document which client flavor (local file vs remote HTTP) each code path requires"],"tags":["unsupported-operation","sync","embedded-replicas","serverless"],"backgroundTag":"unsupported-operation","analyzedSha":"bad083fafbefdeae9a42ec19bdaaad8918dcf411","analyzedAt":"2026-08-16T23:12:11.798Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}