Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why am I getting: Error in processing request. Do not register any parsers before using the adapter #698

Open
garciaraul85 opened this issue Oct 26, 2021 · 1 comment

Comments

@garciaraul85
Copy link

garciaraul85 commented Oct 26, 2021

I am creating a skill using nodejs + express + express adapter.
I want to add a middleware to intercept the request and check the request body to do some verifications but I get this error:
Error in processing request. Do not register any parsers before using the adapter

This is my code for the index.ts:

const app: express.Application = express()

// Skill entry point
const skill = application.getSkillBuilder.createSkillForWebService()

const adapter = new ExpressAdapter(skill, config.verifySignature, config.verifyTimestamp)
app.use(bodyParser.json())

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
app.use((req: any, res: any, next: () => void) => {
	console.log(req)
})
app.post("/", adapter.getRequestHandlers())

const listener = app.listen(PORT, function () {
	const { address, port } = listener.address() as AddressInfo
	logger.debug("%s listening to %s%s", app.name, address, port)
})

So I get the body printed, but I get the error: Error in processing request. Do not register any parsers before using the adapter

But if I remove the line: app.use(bodyParser.json())
The skill works, but the body.req prints undefined in:

app.use((req: any, res: any, next: () => void) => {
	console.log(req)
})

Any tip on how to handle this?

@rahulawl
Copy link
Contributor

Is this issue/feature-request still relevant?
We are working on prioritization of relevant issues and cleanup of rest. If we don’t hear back in 2 weeks, we will assume that the issue is not relevant and we will close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants