Skip to content

React native ios crashes on production with extraHeaders #5120

Open
@ouarrtaha

Description

@ouarrtaha

I need to pass a cookie, for the ingress session affinity, in order to maintain connection in multi pods,
so i set the extraHeaders:

when running the app in debug (in simulator or device) it works as expected, but after releasing ios app in testflight and testing, it crashes,

 Fatal Exception: NSInvalidArgumentException
-[__NSArrayM length]: unrecognized selector sent to instance 0x283dcfde0

To Reproduce

Socket.IO server version: 4.4.0

Server

const io = new Socket(server, {
    transports: ['websocket', 'polling'],
    cors: {
      origin: '*',
      methods: ['GET', 'POST'],
      credentials: true,
    },
    adapter: redisAdapter({
      pubClient: redisClient,
      subClient: redisClient.duplicate(),
    }),
  });

Socket.IO client version: 4.7.2

Client

initSocket(userId, cookie) {
    this.socket = io(SOCKET_URL, {
      query: `userId=${userId}`,
      autoConnect: false,
      transport: ['polling', 'websocket'],
      extraHeaders: {
        'Cookie': cookie,
      },
    });
  }
 

Expected behavior
Connect without crash and maintain connection

Platform:

  • Device: iphone 11
  • OS: ios 17

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions