-
Notifications
You must be signed in to change notification settings - Fork 118
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
#imports has no exported member named 'setUserSession'. Did you mean 'useUserSession'? #333
Comments
Would you mind sharing a minimal reproduction so I can dig into it? 🙏 |
I have the same issue i think. i have this server utility:
It is used in this middleware:
I am getting this error:
getUserSession is perfectly accessible from server/api/somefunction.ts Nuxt Config:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I have been following the basic recipe regarding sessions and authentication on nuxt.com.
In our project set up, we favor making imports explicit which is why autoImports are disabled.
Therefore we resolve auto-imported dependency using import { ... } from '#imports'.
In the case of the login api endpoint this means that I want to resolve setUserSession using
import { setUserSession } from '#imports';
.This has led to following error message:
More readable screenshot:
After losing way too much time, I figured that I can have tsc ignore the error - but this does not seem to be a good solution.
Since the error suggests to use
useUserSession
, it seems that non-server-imports are detected just fine but there is an issue regarding serverImports.I find this odd because when I take a look at
~/.nuxt/types/nitro-imports.ts
, I can see a line which contains setUserSession and other exports:export { sessionHooks, getUserSession, setUserSession, replaceUserSession, clearUserSession, requireUserSession } from '../../../node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/nuxt-auth-utils/dist/runtime/server/utils/session';
Is this sort of behavior normal? Can you tell me the reason why the server imports cannot be resolved?
Is this an issue with my setup? Is this a bug in the module or even in nuxt?
Thanks very much in advance and kind regards,
David
PS: Output of
pnpx nuxi info
:The text was updated successfully, but these errors were encountered: