jeffdpho
jeffdpho
WWasp
Created by jeffdpho on 12/27/2024 in #🙋questions
strange behavior with not finding exports
no, I dug into the code and found the Provider was included, unless I read that wrong, so I didn't try anything with that. What I did notice is if I get the useContext mission error I "wasp clean", "wasp db .." and "wasp start" and then use a different browser and I don't get the error. Thinking it might be something w/ the auth context
16 replies
WWasp
Created by jeffdpho on 12/27/2024 in #🙋questions
strange behavior with not finding exports
Hi @miho , thanks for the response, here is my package.json
{
"name": "test1",
"type": "module",
"dependencies": {
"@heroicons/react": "^2.2.0",
"@material-tailwind/react": "^2.1.10",
"@radix-ui/react-slot": "^1.1.1",
"@tanstack/react-query": "^4.29.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"date-fns": "^4.1.0",
"heroicons": "^2.2.0",
"lucide-react": "^0.469.0",
"react": "^18.2.0",
"react-helmet": "^6.1.0",
"tailwind-merge": "^2.5.5",
"tailwindcss-animate": "^1.0.7",
"wasp": "file:.wasp/out/sdk/wasp"
},
"devDependencies": {
"@tanstack/react-query-devtools": "^4.29.0",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.49",
"prisma": "5.19.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.1.0"
}
}
{
"name": "test1",
"type": "module",
"dependencies": {
"@heroicons/react": "^2.2.0",
"@material-tailwind/react": "^2.1.10",
"@radix-ui/react-slot": "^1.1.1",
"@tanstack/react-query": "^4.29.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"date-fns": "^4.1.0",
"heroicons": "^2.2.0",
"lucide-react": "^0.469.0",
"react": "^18.2.0",
"react-helmet": "^6.1.0",
"tailwind-merge": "^2.5.5",
"tailwindcss-animate": "^1.0.7",
"wasp": "file:.wasp/out/sdk/wasp"
},
"devDependencies": {
"@tanstack/react-query-devtools": "^4.29.0",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.49",
"prisma": "5.19.1",
"tailwindcss": "^3.4.17",
"typescript": "^5.1.0"
}
}
16 replies
WWasp
Created by jeffdpho on 12/27/2024 in #🙋questions
strange behavior with not finding exports
@Filip The second issue I get, which seems to be a race, cache, timing, or sequencing issue in the auth provider setup for google. I am using the google auth instructions here ( https://wasp-lang.dev/docs/auth/social-auth/google ). The full rebuild/reinstall mentioned above did not resolve this issue. The username/password auth is ok. 1. I setup google auth 2. I login successfully (it works) 3. I make a change or rebuild the site (wasp clean/wasp db migrate-dev/wasp start, etc..) 4. /login (successfully) but on the redirect I get the following error (below) 5. Usually, if I switch between chrome/firefox or chrome/firefox icognito the issue resolves. Clearning the cache sometimes will work but not all the time.
6. Using username/password doesn't seem to have the issue Here is my wasp.main entry:
auth: {
userEntity: User,
methods: {
usernameAndPassword: {},
google: {
configFn: import { getGoogleAuthConfig } from "@src/server/auth/google.js",
userSignupFields: import { userSignupFields } from "@src/server/auth/google.js"
},
},
onAuthFailedRedirectTo: "/login",
onAuthSucceededRedirectTo: "/"
},
auth: {
userEntity: User,
methods: {
usernameAndPassword: {},
google: {
configFn: import { getGoogleAuthConfig } from "@src/server/auth/google.js",
userSignupFields: import { userSignupFields } from "@src/server/auth/google.js"
},
},
onAuthFailedRedirectTo: "/login",
onAuthSucceededRedirectTo: "/"
},
google.js
export const getGoogleAuthConfig = () => ({
clientID: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
callbackURL: "https://testsite.io/auth/google/callback",
scopes: ['email', 'profile', 'openid']
})

export const userSignupFields = {
isSignupComplete: () => true,
email: (data) => data?.profile?.email,
hd: (data) => data?.profile?.hd,
picture: (data) => data?.profile?.picture
}
export const getGoogleAuthConfig = () => ({
clientID: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
callbackURL: "https://testsite.io/auth/google/callback",
scopes: ['email', 'profile', 'openid']
})

export const userSignupFields = {
isSignupComplete: () => true,
email: (data) => data?.profile?.email,
hd: (data) => data?.profile?.hd,
picture: (data) => data?.profile?.picture
}
react-router-dom.js?v=c3e21e73:4056 React Router caught the following error during render TypeError: Cannot read properties of null (reading 'useContext')
at useQuery (hooks.ts:28:10)
at useAuth (useAuth.ts:15:10)
at useOAuthCallbackHandler (OAuthCallback.tsx:36:52)
at OAuthCallbackPage (OAuthCallback.tsx:13:27)
react-router-dom.js?v=c3e21e73:4056 React Router caught the following error during render TypeError: Cannot read properties of null (reading 'useContext')
at useQuery (hooks.ts:28:10)
at useAuth (useAuth.ts:15:10)
at useOAuthCallbackHandler (OAuthCallback.tsx:36:52)
at OAuthCallbackPage (OAuthCallback.tsx:13:27)
16 replies
WWasp
Created by jeffdpho on 12/27/2024 in #🙋questions
strange behavior with not finding exports
@Filip , Thanks for your response. To clarify I'm using the instructions ( https://wasp-lang.dev/docs/data-model/operations/overview, https://wasp-lang.dev/docs/data-model/operations/queries, https://wasp-lang.dev/docs/data-model/operations/actions ) suggested in the following page which are great. However, when I ended up getting a missing "exports" from (1) queries/actions or the (2) missing "useContext" I almost always have switch browsers (chrome, Firefox, Chrome or Firefox Incognito) , full clean and rebuild or sometimes both and it seems to solve the issues. I don't think the two issues are related. I hope this helps and maybe it's a minor overlook somewhere. Update: I did a full rebuild/reinstall and install on node, npm , wasp, package.json, et. all and I don't get the "missing exports" issue anymore -- 🤞
16 replies