Questions tagged [next-connect]
The next-connect tag has no usage guidance.
35
questions
0
votes
0
answers
22
views
next_connect__WEBPACK_IMPORTED_MODULE_3__.default) is not a function
import dbConnect from '../../lib/mongodb';
import Job from '../../models/Job';
import multer from 'multer';
import nextConnect from 'next-connect';
import fs from 'fs';
import path from 'path';
const ...
0
votes
1
answer
205
views
Add helmet to nextjs middleware
I have a full-stack nextjs application and I want to add helmet for having secure headers.
I try to use 'next-connect' package but helmet won't add new headers to response headers.
(I am using ...
1
vote
0
answers
92
views
Error in NextJS handler after updating all packages(Next-Connect error)
import cookieSession from 'cookie-session';
import { NextApiRequest, NextApiResponse } from 'next';
import nc from 'next-connect';
import { error } from 'next/dist/build/output/log';
import passport ...
1
vote
1
answer
1k
views
Next-connect error : unable to use next-connect for routing in my next.js project with javascript
My next version is 13.4.5 (latest)
My next-connect version is 1.0.0 (latest)
In pages>api>auth>signup.js :
import { createRouter } from "next-connect"
const handler = createRouter()...
0
votes
0
answers
1k
views
How do i use next connect package with next js 13
I started an application with the latest version of Next Js and i tried to use next-connect to structure my routes because of things like middleware before routes which is how i did in version 12, ...
4
votes
0
answers
1k
views
Typescript error when using next-connect - This expression is not callable. Type 'typeof import(...)' has no call signatures
I am trying to implement a function where a file will be uploaded to the public folder of the nextjs app using next-connect. But getting a typescript error -
This expression is not callable.
Type '...
0
votes
1
answer
489
views
How to use authorization in NextJS API Backend?
I have working nextjs app using prisma as ORM. I have this page: /somecats which connect to nextjs backend (/pages/api/categories). When I execute http://localhost:3000/api/requests), it not require ...
0
votes
1
answer
67
views
Failing to create relationship logic between two database tables using Prisma and Javascript
This is, as far as I can tell, a logic problem that I just can't wrap my head around. Using next-connect I have a function for updating an entry in the database:
.put(async (req, res) => {
...
0
votes
1
answer
2k
views
How to implement iron-session with session id
I am using iron-session, next-connect with nextjs in our webapp and one of the requirements is to publish analytics events from our frontend code, like page views, button clicks and other custom ...
0
votes
1
answer
8k
views
failed login redirects me to /api/auth/error on next-auth
I'm using next-auth v. 4.18.8 in my login page. This is the final project of my Fullstack JS course. I'm using a newer version than the one used in the course (next-auth v. 3 is used)
When I insert ...
0
votes
0
answers
117
views
Redirect from client side and server side in nextJS
I am using next-connect to chain middleware inside the getServerSideProps and have the same set of middleware in the next JS API. I am calling the same using axios on client side.
How do I write a ...
4
votes
2
answers
1k
views
Override request type in next-connect middleware
I'm using next-connect with next.js & typescript, and I want to create a middleware that adds some fields to request object and infer the new request type. The code below:
// multipart middleware
...
1
vote
0
answers
133
views
NextConnect use a middleware inside another
I have an auth middleware that I want to use it's logic to develop other middlewares (ie: adminMiddleware, receptionMiddleware ...)
// adminMiddleware.ts
const authMiddleware = async (
req: ...
2
votes
0
answers
29
views
'next-connect' error (nextConnect is undefined) [duplicate]
I am trying to integrate 'next-connect' into my Nextjs app in order to use multer inside of my middleware. I cannot import multer using the Nextjs built-in middleware feature (the one where you create ...
4
votes
2
answers
6k
views
Server Error TypeError: (0 , next_connect__WEBPACK_IMPORTED_MODULE_0__.default) is not a function
I've got this error while using next-connect package.(i'm following a guy on youtube)
here's my code
import nc from 'next-connect';
import Product from '../../../models/Product';
import db from '../.....