appkit_cache_entries migration ownership issue

Ouverte
#648 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 3 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
28/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
postgresql, typescript
Domaine
backend, databases

Piste de recherche

The failing migrations run from PersistentStorage.runMigrations in src/cache/storage/persistent.ts (around line 324), called from PersistentStorage.initialize and CacheManager.create in src/cache/index.ts. Start by reading how the pg pool is created and which role runs the DDL. The issue leaves the option's name and shape open, so agree the design with maintainers before coding. Done when a migration role can be configured and the table-owner error no longer occurs.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Problem

When starting an appkit locally, Appkit tries to run a migration script for the appkit_cache_entries table.
When the migration runs for the first time, it locks the owner as the current identity. If we have the app deployed in Databricks, it will use the App service principal.

The problem comes when another user tries to run the app with their own credentials. The migration will fail because Appkit will try the default identity to run the DDLs, which is not the owner of the table/schema.

Proposed Solution

I propose Appkit allow us to define a role to run migrations as an optional parameter.

Detailed error message

[appkit:cache:persistent] Migration step 'create index (key_hash)' failed: error: must be owner of table appkit_cache_entries
    at C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\[email protected][email protected]\node_modules\pg-pool\index.js:45:11
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
    at async PersistentStorage.runMigrations (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\cache\storage\persistent.ts:324:9)
    at async PersistentStorage.initialize (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\cache\storage\persistent.ts:58:7)
    at async CacheManager.create (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\cache\index.ts:188:9)
    at async AppKit._createApp (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\core\appkit.ts:214:5) {
  length: 103,
  severity: 'ERROR',
  code: '42501',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'aclchk.c',
  line: '2981',
  routine: 'aclcheck_error'
}
[appkit:cache:persistent] Error in persistent storage initialization: InitializationError: Error in running migrations for persistent storage
    at InitializationError.migrationFailed (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\errors\initialization.ts:47:12)
    at PersistentStorage.runMigrations (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\cache\storage\persistent.ts:327:35)
    at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
    at async PersistentStorage.initialize (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\cache\storage\persistent.ts:58:7)
    at async CacheManager.create (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\cache\index.ts:188:9)
    at async AppKit._createApp (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\core\appkit.ts:214:5) {
  cause: error: must be owner of table appkit_cache_entries
      at C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\[email protected][email protected]\node_modules\pg-pool\index.js:45:11
      at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
      at async PersistentStorage.runMigrations (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\cache\storage\persistent.ts:324:9)
      at async PersistentStorage.initialize (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\cache\storage\persistent.ts:58:7)
      at async CacheManager.create (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\cache\index.ts:188:9)
      at async AppKit._createApp (C:\Users\aborsato\dev\udp\supply-chain-apps\red_keychain\src\red_keychain\node_modules\.pnpm\@[email protected]_@_71adcd3664c0a60618d3aa5c60033ec6\node_modules\@databricks\appkit\src\core\appkit.ts:214:5) {
    length: 103,
    severity: 'ERROR',
    code: '42501',
    detail: undefined,
    hint: undefined,
    position: undefined,
    internalPosition: undefined,
    internalQuery: undefined,
    where: undefined,
    schema: undefined,
    table: undefined,
    column: undefined,
    dataType: undefined,
    constraint: undefined,
    file: 'aclchk.c',
    line: '2981',
    routine: 'aclcheck_error'
  },
  context: undefined,
  _clientMessage: undefined,
  code: 'INITIALIZATION_ERROR',
  statusCode: 500,
  isRetryable: true
}
Langage dominant
TypeScript
Étoiles
119
Forks
36
Merge moyen
4 j 16 h
PR mergées (30 j)
37

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de databricks/appkit

Toutes les issues de databricks/appkit

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.