Skip to content

[Bug?]: imported db missing some property after setup uploads & storage feature (TS2739) #12043

Description

@alfi-dim

What's not working?

got this ts error on my api/src/functions/auth.ts

TS2739: Type

DynamicClientExtensionThis<TypeMap<InternalArgs & { result: { user: { withDataUri: () => { needs: Record<string, boolean>; compute: (modelData: Record<string, unknown>) => <T>(this: T) => Promise<T>; }; withSignedUrl: () => { ...; }; }; }; model: {}; query: {}; client: {}; }, PrismaClientOptions>, TypeMapCb, { ...; ...

is missing the following properties from type

PrismaClient<PrismaClientOptions, never, DefaultArgs>

How do we reproduce the bug?

run yarn rw setup uploads

extends prisma client with storage extension

db.ts

// See https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/constructor
// for options.

import { PrismaClient } from '@prisma/client'

import { emitLogLevels, handlePrismaLogging } from '@redwoodjs/api/logger'

import { logger } from './logger'
import { storagePrismaExtension } from './uploads'

const prismaClient = new PrismaClient({
  log: emitLogLevels(['info', 'warn', 'error']),
})

handlePrismaLogging({
  db: prismaClient,
  logger,
  logLevels: ['info', 'warn', 'error'],
})

/**
 * Global Prisma client extensions should be added here, as $extend
 * returns a new instance.
 * export const db = prismaClient.$extend(...)
 * Add any .$on hooks before using $extend
 */
export const db = prismaClient.$extends(storagePrismaExtension)

What's your environment? (If it applies)

System:
    OS: Windows 11 10.0.22631
  Binaries:
    Node: 20.18.1 - ~\AppData\Local\Temp\xfs-4298cc3e\node.CMD
    Yarn: 4.6.0 - ~\AppData\Local\Temp\xfs-4298cc3e\yarn.CMD
  Browsers:
    Edge: Chromium (134.0.3124.85)
  npmPackages:
    @redwoodjs/auth-dbauth-setup: 8.5.0 => 8.5.0 
    @redwoodjs/cli-storybook-vite: 8.5.0 => 8.5.0 
    @redwoodjs/core: 8.5.0 => 8.5.0 
    @redwoodjs/project-config: 8.5.0 => 8.5.0 
  redwood.toml:
    [web]
      title = "BISA"
      port = 8910
      apiUrl = "/.redwood/functions" # You can customize graphql and dbauth urls individually too: see https://redwoodjs.com/docs/app-configuration-redwood-toml#api-paths        
      includeEnvironmentVariables = [
        # Add any ENV vars that should be available to the web side to this array
        # See https://redwoodjs.com/docs/environment-variables#web
      ]
    [api]
      port = 8911
    [browser]
      open = false
    [notifications]
      versionUpdates = ["latest"]
    [generate]
      tests = false
      stories = false

Are you interested in working on this?

  • I'm interested in working on this

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/needs-infoMore information is needed for reproduction

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions