To reproduce:
- Clone the repo.
1a. add a file .env in the root dir with values CONFLUENT_API_KEY and CONFLUENT_API_SECRET from a cloud env you've set up with a topic named 'test'
-
npm install
-
run
npx next dev
-
navigate to 'http://localhost:3000/event-sourced' in your browser
-
View the error.
-
Now, to try with Kafkajs, change line 2 in consumer.js to
import { consumer } from "./workingwithkafka";
-
Change line 2 in event-sourced/page.jsx to
import { producer } from "../../workingwithkafka";
-
Save the changes. Run Ctrl+C to stop the server, then
npx next dev
to re-run it. -
You should see the downstream error emanating from
db.js
,Error: Cannot read properties of undefined (reading '0')
, which indicates that the app is past kafka errors. You can confirm that kafka is working here by viewing the messages in your 'test' topic