xmtp / example-chat-react

This repo has been archived. Replacement apps include the XMTP Quickstart React and XMTP Inbox chat apps. For more details and links, see the README in this repo.
MIT License
74 stars 52 forks source link

Bug: Conversation IDs containing double slashes (//) break the conversation page #169

Open nakajima opened 1 year ago

nakajima commented 1 year ago

Describe the bug

I created a conversation with conversationId "https://example.com". When visited on the website, the following error shows up in the console:

image

Messages can't be sent/received and it doesn't appear correctly in the conversation list:

image

Steps to Reproduce

Running the following script will let you see the error:

import { Client } from '@xmtp/xmtp-js'
import { Wallet } from 'ethers'

const wallet = Wallet.createRandom()

async function checkAll() {
  const client = await Client.create(wallet, { env: 'dev' })
  const convo = await client.conversations.newConversation(
    'ENTER YOUR ADDRESS HERE',
    {
      conversationId: 'fizz//buzz',
      metadata: {},
    }
  )

  await convo.send('hi')
}

checkAll().then(() => console.log('Done'))