Describe the Bug
I'm trying to use CE javascript SDK in a React app. I have the following err:
ERROR in ./node_modules/cloudevents/dist/transport/http/index.js 16:31-46
Module not found: Error: Can't resolve 'http' in '/home/ksuszyns/git/openshift-knative-showcase/frontend/node_modules/cloudevents/dist/transport/http'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }
That error is thrown just after trying to create the CE:
const ce = new CloudEvent({})
I just wanted to parse incoming Server Sent Events data that is in structured-mode CE.
Steps to Reproduce
- Create React app with:
npx create-react-app frontend --template typescript
- Install CE:
npm i --save cloudevents
- Import CE and attempt to create basic object:
import { CloudEvent } from 'cloudevents'
const ce = new CloudEvent({})
You can also see this error on this commit: cardil/openshift-knative-showcase@cc8ffe2
Expected Behavior
I just want to create basic CE objects, in React app. And parse them from the JSON text, in the near future. No errors should be thrown.
Describe the Bug
I'm trying to use CE javascript SDK in a React app. I have the following err:
That error is thrown just after trying to create the CE:
I just wanted to parse incoming Server Sent Events data that is in structured-mode CE.
Steps to Reproduce
npx create-react-app frontend --template typescriptnpm i --save cloudeventsYou can also see this error on this commit: cardil/openshift-knative-showcase@cc8ffe2
Expected Behavior
I just want to create basic CE objects, in React app. And parse them from the JSON text, in the near future. No errors should be thrown.