Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Soketi Does Not Connect #1024

Open
renchris opened this issue Oct 30, 2023 · 2 comments
Open

[BUG] Soketi Does Not Connect #1024

renchris opened this issue Oct 30, 2023 · 2 comments
Assignees
Labels
status:triage Awaiting triage.

Comments

@renchris
Copy link

Description
Trying to set up a Soketi client connection without the need for a Pusher account and Pusher app. Unable to connect with the error message of App key does not exist

image

Reproduction steps
Steps to reproduce the behavior:

  1. Install Soketi with pnpm install -g @soketi/soketi
  2. Run Soketi with soketi start
  3. Create Pusher client connection in application code (NextJS application)
import Pusher from 'pusher-js'

  const pusher = new Pusher(process.env.NEXT_PUBLIC_SOKETI_DEFAULT_APP_ID ?? 'app-id', {
    cluster: 'us3',
    wsHost: '127.0.0.1',
    wsPort: 6001,
    forceTLS: false,
    enabledTransports: ['ws', 'wss'],
  })
  1. Run application with pnpm dev
  2. Go to localhost:3000 and receive the error and notice that the connection succeeds to connect.

Expected behavior
I would expect that the Pusher instance would be able to connect successfully to our local Soketi host and port address without the need for a Pusher account and app.

Screenshots

image

Environment

  • Soketi version (i.e. 1.3.0): 1.6.0
  • Adapter (local, redis): local
  • App Manager (array, mysql, postgres, dynamodb) : array
  • Queue (sqs, redis, sync): sync (?)
  • Cache Managers (memory, redis): memory (?)

Configuration
Run the server with SOKETI_DEBUG=1 and paste the nested object configuration that outputs:

{
  adapter: {
    driver: 'local',
    redis: {
      requestsTimeout: 5000,
      prefix: '',
      redisPubOptions: {},
      redisSubOptions: {},
      clusterMode: false
    },
    cluster: { requestsTimeout: 5000 },
    nats: {
      requestsTimeout: 5000,
      prefix: '',
      servers: [ '127.0.0.1:4222' ],
      user: null,
      pass: null,
      token: null,
      timeout: 10000,
      nodesNumber: null
    }
  },
  appManager: {
    driver: 'array',
    cache: { enabled: false, ttl: -1 },
    array: {
      apps: [
        {
          id: 'app-id',
          key: 'app-key',
          secret: 'app-secret',
          maxConnections: -1,
          enableClientMessages: false,
          enabled: true,
          maxBackendEventsPerSecond: -1,
          maxClientEventsPerSecond: -1,
          maxReadRequestsPerSecond: -1,
          webhooks: []
        }
      ]
    },
    dynamodb: { table: 'apps', region: 'us-east-1', endpoint: null },
    mysql: { table: 'apps', version: '8.0', useMysql2: false },
    postgres: { table: 'apps', version: '13.3' }
  },
  cache: { driver: 'memory', redis: { redisOptions: {}, clusterMode: false } },
  channelLimits: { maxNameLength: 200, cacheTtl: 3600 },
  cluster: {
    hostname: '0.0.0.0',
    helloInterval: 500,
    checkInterval: 500,
    nodeTimeout: 2000,
    masterTimeout: 2000,
    port: 11002,
    prefix: '',
    ignoreProcess: true,
    broadcast: '255.255.255.255',
    unicast: null,
    multicast: null
  },
  cors: {
    credentials: true,
    origin: [ '*' ],
    methods: [ 'GET', 'POST', 'PUT', 'DELETE', 'OPTIONS' ],
    allowedHeaders: [
      'Origin',
      'Content-Type',
      'X-Auth-Token',
      'X-Requested-With',
      'Accept',
      'Authorization',
      'X-CSRF-TOKEN',
      'XSRF-TOKEN',
      'X-Socket-Id'
    ]
  },
  database: {
    mysql: {
      host: '127.0.0.1',
      port: 3306,
      user: 'root',
      password: 'password',
      database: 'main'
    },
    postgres: {
      host: '127.0.0.1',
      port: 5432,
      user: 'postgres',
      password: 'password',
      database: 'main'
    },
    redis: {
      host: '127.0.0.1',
      port: 6379,
      db: 0,
      username: null,
      password: null,
      keyPrefix: '',
      sentinels: null,
      sentinelPassword: null,
      name: 'mymaster',
      clusterNodes: []
    }
  },
  databasePooling: { enabled: false, min: 0, max: 7 },
  debug: 1,
  eventLimits: {
    maxChannelsAtOnce: 100,
    maxNameLength: 200,
    maxPayloadInKb: 100,
    maxBatchSize: 10
  },
  host: '0.0.0.0',
  httpApi: { requestLimitInMb: 100, acceptTraffic: { memoryThreshold: 85 } },
  instance: { process_id: 3201 },
  metrics: {
    enabled: false,
    driver: 'prometheus',
    host: '0.0.0.0',
    prometheus: { prefix: 'soketi_' },
    port: 9601
  },
  mode: 'full',
  port: 6001,
  pathPrefix: '',
  presence: { maxMembersPerChannel: 100, maxMemberSizeInKb: 2 },
  queue: {
    driver: 'sync',
    redis: { concurrency: 1, redisOptions: {}, clusterMode: false },
    sqs: {
      region: 'us-east-1',
      endpoint: null,
      clientOptions: {},
      consumerOptions: {},
      queueUrl: '',
      processBatch: false,
      batchSize: 1,
      pollingWaitTimeMs: 0
    }
  },
  rateLimiter: { driver: 'local', redis: { redisOptions: {}, clusterMode: false } },
  shutdownGracePeriod: 3000,
  ssl: { certPath: '', keyPath: '', passphrase: '', caPath: '' },
  userAuthenticationTimeout: 30000,
  webhooks: { batching: { enabled: false, duration: 50 } }
}

Additional context (Additional attempts)

I additionally tried using the server-side Pusher library pusher (pusher-http-node) and that did not help either. For that, I noticed that in the README.md it explicitly states a Pusher account and app are required, so I moved back to using the pusher-js library

I additionally tried both having the env variables inline in the terminal command with SOKETI_DEBUG=1 SOKETI_DEFAULT_APP_ID=app-id soketi start as well as with a config file with soketi start --config=soketi.config.json and the config file of

{
    "debug": true,
    "port": 6001,
    "appManager.array.apps": [
      {
        "id": "app-id",
        "key": "app-key",
        "secret": "app-secret",
        "maxConnections": -1,
        "enableClientMessages": false,
        "enabled": true,
        "maxBackendEventsPerSecond": -1,
        "maxClientEventsPerSecond": -1,
        "maxReadRequestsPerSecond": -1,
        "webhooks": []
      }
    ]
  }

I have my .env.local file to be

NEXT_PUBLIC_SOKETI_DEFAULT_APP_ID=app-id
NEXT_PUBLIC_SOKETI_PUSHER_KEY=key
NEXT_PUBLIC_SOKETI_PUSHER_SECRET=secret
NEXT_PUBLIC_SOKETI_PUSHER_CLUSTER=us3
SOKETI_DEBUG=1
@renchris renchris added the status:triage Awaiting triage. label Oct 30, 2023
@codeautopilot
Copy link

codeautopilot bot commented Oct 30, 2023

Disclaimer: This comment was entirely generated using AI. Be aware that the information provided may be incorrect.

Your organization has reached the subscribed usage limit. Cannot process the task. You can upgrade your plan at https://www.codeautopilot.com/#pricing


Current plan usage: 159.51%


Have feedback or need help?

Discord
Documentation
[email protected]

@Vap0r1ze
Copy link

i know this is late, but you need to use the app-key not the app-id

and the error is telling you that your environment variable doesnt exist, and its defaulting to the "app-id" string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:triage Awaiting triage.
Development

No branches or pull requests

3 participants