socketio / socket.io-aws-sqs-adapter

The Socket.IO adapter for AWS Simple Queue Service (SQS), allowing to broadcast events between several Socket.IO servers.
https://www.npmjs.com/package/@socket.io/aws-sqs-adapter
MIT License
4 stars 1 forks source link

There is no default value for opts in createAdapter #2

Closed iMokhonko closed 3 months ago

iMokhonko commented 4 months ago

So I was trying to use createAdapter function based on documentation example and it errored out with this error.

const topicName = opts.topicName || "socket-io";
                           ^
TypeError: Cannot read properties of undefined (reading 'topicName')

Basically if you do not provide options object it will be undefined. Maybe it will be better to rewrite like this

const topicName = opts?.topicName ?? "socket-io";
darrachequesne commented 4 months ago

Thanks for the heads-up! There should indeed be a default value :+1:

darrachequesne commented 3 months ago

This should be fixed by https://github.com/socketio/socket.io-aws-sqs-adapter/commit/cda506606e4fc4d41e7e71db2b41c81655cc6aa2, included in version 0.1.1. Thanks for the heads-up!