syncTroubleshootingEntries() — supabase Function Reference
Architecture documentation for the syncTroubleshootingEntries() function in Troubleshooting.script.mjs from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD 9518e40b_fa13_8f55_5b39_98d14611b96a["syncTroubleshootingEntries()"] f2c16cca_2fa5_af0d_238c_836937bd5c8f["main()"] f2c16cca_2fa5_af0d_238c_836937bd5c8f -->|calls| 9518e40b_fa13_8f55_5b39_98d14611b96a c47627f8_4606_a55c_a1af_372a54f76a02["getAllTroubleshootingDiscussions()"] 9518e40b_fa13_8f55_5b39_98d14611b96a -->|calls| c47627f8_4606_a55c_a1af_372a54f76a02 0ef11190_eedb_5b54_2a24_8b50ce4fb9b0["entryExists()"] 9518e40b_fa13_8f55_5b39_98d14611b96a -->|calls| 0ef11190_eedb_5b54_2a24_8b50ce4fb9b0 f61bdb66_07a9_05bc_fe90_1968fa6ad375["getGithubIdForDiscussion()"] 9518e40b_fa13_8f55_5b39_98d14611b96a -->|calls| f61bdb66_07a9_05bc_fe90_1968fa6ad375 34c95dd3_9362_604e_4560_37203bbf5659["createGithubDiscussion()"] 9518e40b_fa13_8f55_5b39_98d14611b96a -->|calls| 34c95dd3_9362_604e_4560_37203bbf5659 e926cdbb_331d_6134_8646_8624e91b648e["insertNewTroubleshootingEntry()"] 9518e40b_fa13_8f55_5b39_98d14611b96a -->|calls| e926cdbb_331d_6134_8646_8624e91b648e 9d0b0ff2_ab52_c9d0_6f1a_38e258894bd1["rollbackGithubDiscussion()"] 9518e40b_fa13_8f55_5b39_98d14611b96a -->|calls| 9d0b0ff2_ab52_c9d0_6f1a_38e258894bd1 d46c3b2d_94ca_5826_3532_ade3c61a1590["updateFileId()"] 9518e40b_fa13_8f55_5b39_98d14611b96a -->|calls| d46c3b2d_94ca_5826_3532_ade3c61a1590 9fb0512e_b8b0_fd5b_0755_8ccbb0346831["updateChecksumIfNeeded()"] 9518e40b_fa13_8f55_5b39_98d14611b96a -->|calls| 9fb0512e_b8b0_fd5b_0755_8ccbb0346831 1dbedd6f_a4f8_c098_dc20_7090d63d4f6b["updateGithubDiscussion()"] 9518e40b_fa13_8f55_5b39_98d14611b96a -->|calls| 1dbedd6f_a4f8_c098_dc20_7090d63d4f6b style 9518e40b_fa13_8f55_5b39_98d14611b96a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/docs/features/docs/Troubleshooting.script.mjs lines 76–134
async function syncTroubleshootingEntries() {
console.log('[START] Syncing troubleshooting entries to GitHub')
const [troubleshootingEntries, discussions] = await Promise.all([
getAllTroubleshootingEntries(),
getAllTroubleshootingDiscussions(),
])
console.log(`[INFO] Found ${troubleshootingEntries.length} existing entries`)
const tasks = troubleshootingEntries.map(async (entry) => {
const databaseId = entry.data.database_id
if (databaseId.startsWith('pseudo-')) {
// The database entry is faked, so we may need to create a new one.
// There's also an edge case we need to check for: the entry has already
// been created, but the new database ID hasn't been written to the file
// yet.
if (await entryExists(entry)) return
const discussion = entry.data.github_url
? await getGithubIdForDiscussion(discussions, entry)
: await createGithubDiscussion(entry)
let id
try {
id = await insertNewTroubleshootingEntry(entry, discussion)
} catch (error) {
console.error(`[ERROR] Failed to insert new entry for ${entry.data.title}: %O`, error)
console.log(
`[INFO] Rolling back discussion creation for ${entry.data.title} (GitHub ID ${discussion.id})`
)
await rollbackGithubDiscussion(discussion.id)
throw error
}
await updateFileId(entry, id)
} else {
// The database entry already exists, so check for updates.
const contentHasChanged = await updateChecksumIfNeeded(entry)
if (contentHasChanged) {
await updateGithubDiscussion(entry)
}
}
})
const results = await Promise.allSettled(tasks)
let hasErrors = false
results.forEach((result, index) => {
if (result.status === 'rejected') {
console.error(
`[ERROR] Failed to insert and/or update for ${troubleshootingEntries[index].filePath}:\n%O`,
result.reason?.errors ?? result.reason
)
hasErrors = true
}
})
return hasErrors
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does syncTroubleshootingEntries() do?
syncTroubleshootingEntries() is a function in the supabase codebase.
What does syncTroubleshootingEntries() call?
syncTroubleshootingEntries() calls 9 function(s): createGithubDiscussion, entryExists, getAllTroubleshootingDiscussions, getGithubIdForDiscussion, insertNewTroubleshootingEntry, rollbackGithubDiscussion, updateChecksumIfNeeded, updateFileId, and 1 more.
What calls syncTroubleshootingEntries()?
syncTroubleshootingEntries() is called by 1 function(s): main.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free