Skip to content

[Bug]: graphql.ts is not updated during realtime setup #512

@Tobbe

Description

@Tobbe

What's not working?

When running yarn cedar setup realtime a lot of files are created, but api/src/functions/graphql.ts is not updated to actually enable realtime (subscription) support.

It should look like this

import { createAuthDecoder } from '@cedarjs/auth-dbauth-api'
import { createGraphQLHandler } from '@cedarjs/graphql-server'

import directives from 'src/directives/**/*.{js,ts}'
import sdls from 'src/graphql/**/*.sdl.{js,ts}'
import services from 'src/services/**/*.{js,ts}'

import { cookieName, getCurrentUser } from 'src/lib/auth'
import { db } from 'src/lib/db'
import { logger } from 'src/lib/logger'
import { realtime } from 'src/lib/realtime'

const authDecoder = createAuthDecoder(cookieName)

export const handler = createGraphQLHandler({
  authDecoder,
  getCurrentUser,
  loggerConfig: { logger, options: {} },
  directives,
  sdls,
  services,
  realtime,
  onException: () => {
    // Disconnect from your database with an unhandled exception.
    db.$disconnect()
  },
})

But in reality neither the import from 'src/lib/realtime' nor the inclusion of realtime in the createGraphQLHandler() call is being added

How do we reproduce the bug?

Run yarn cedar setup realtime and you'll notice that nothing related to realtime support has been added to the graphql handler

What's your environment? (If it applies)

System:
    OS: macOS 15.2
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.11.0 - /private/var/folders/7j/9p56mwmj6jsfdr2h5_884j9w0000gn/T/xfs-daeeac64/node
    Yarn: 4.4.0 - /private/var/folders/7j/9p56mwmj6jsfdr2h5_884j9w0000gn/T/xfs-daeeac64/yarn
  Databases:
    SQLite: 3.43.2 - /usr/bin/sqlite3
  Browsers:
    Safari: 18.2
  npmPackages:
    @cedarjs/auth-dbauth-setup: 0.15.0 => 0.15.0
    @cedarjs/core: 0.15.0 => 0.15.0
    @cedarjs/project-config: 0.15.0 => 0.15.0
  redwood.toml:
    [web]
      title = "Victory"
      port = 8910
      apiUrl = "/.redwood/functions"
      includeEnvironmentVariables = [
        # Add any ENV vars that should be available to the web side to this array
        # See https://cedarjs.com/docs/environment-variables#web
      ]
    [api]
      port = 8911
    [browser]
      open = true
    [notifications]
      versionUpdates = ["latest"]
    [generate]
      tests = false
      stories = false

Are you interested in working on this?

  • I'm interested in working on this

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