N
Nuxt3mo ago
kb

N2 > 3 server middleware issue

Hey, Im trying to transplant some functionality from a nuxt2 project, where we had ~/server_middleware/authauth.js which has some imports in like
import { AVAILABLE_STRATEGIES, AVAILABLE_METHODS } from '../constants/auth'
import {
ERROR_AUTHAUTH_SERVER_MIDDLEWARE_BAD_REQUEST,
ERROR_AUTHAUTH_SERVER_MIDDLEWARE_UNKNOWN_REQUEST,
ERROR_AUTHAUTH_SERVER_MIDDLEWARE_STRATEGY_AUTHENTICATION_ERROR,
} from '../constants/errors'
import { getStrategyCredentials, getStrategyEndpoint } from '../utils/authCredentials'
import { AVAILABLE_STRATEGIES, AVAILABLE_METHODS } from '../constants/auth'
import {
ERROR_AUTHAUTH_SERVER_MIDDLEWARE_BAD_REQUEST,
ERROR_AUTHAUTH_SERVER_MIDDLEWARE_UNKNOWN_REQUEST,
ERROR_AUTHAUTH_SERVER_MIDDLEWARE_STRATEGY_AUTHENTICATION_ERROR,
} from '../constants/errors'
import { getStrategyCredentials, getStrategyEndpoint } from '../utils/authCredentials'
so now in nuxt3, I have made ~\server\api\authauth.post.js which i think is right? and those same imports with updated pathing like import { getStrategyCredentials, getStrategyEndpoint } from '../../utils/authCredentials' but I get [15:14:52] ERROR [worker reload] [worker init] Cannot find module 'C:\Users\constants\auth' imported from C:\Users\myuser\Repos\myrepo\.nuxt\dev\index.mjs any ideas?
1 Reply
kb
kbOP3mo ago
ok since realised i should be in /server/middleware so updated that, but same issue anyone? D:
Want results from more Discord servers?
Add your server