Trpc + websocket deployment failed

I am following this link GitHub - trpc/examples-next-prisma-websockets-starter: 🏓 tRPC Next.js WebSocket Starter to deploy an app with TRPC and websocket. My render.yaml is as follows:

  - type: web
    name: stella-shopsage-trpc
    env: node
    plan: free
    # NODE_ENV is development here in order for npm to install dev deps
    buildCommand: NODE_ENV=development npm install && npm build
    startCommand: npm start
    healthCheckPath: /api/trpc/healthcheck
    # Preview Environment Initialization
    # initialDeployHook: |
    # npm run db-seed
      - key: NODE_ENV
        value: production

      # - key: DATABASE_URL
      #   fromDatabase:
      #     name: stella-shopsage-trpc-db
      #     property: connectionString

      - fromGroup: stella-shopsage-trpc
# databases:
#   - name: stella-shopsage-trpc-db
#     plan: free
#     # plan: starter

and the failed log is as follows:

Error: Cannot find module '/opt/render/project/src/dist/server/prodServer.js'


Maybe your build command isn’t quite right:

  • I think npm build should likely be npm run build

  • Also, # NODE_ENV is development here in order for npm to install dev deps - Render doesn’t set a default NODE_ENV on builds, so this shouldn’t be necessary to install devDependencies docs
    Although, if you’re setting your own NODE_ENV to production in the environments tab, npm install --production false would have the same effect npm docs


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.