saeris
06/23/2022, 10:24 AM_middleware.js
, as it runs in a different runtime. You can't use fs
, this is why this is happening. https://nextjs.org/docs/api-reference/edge-runtime#unsupported-apis
Is your @/config/index
import reading from the filesystem? if it is, you will need to change up however you are loading config values. Perhaps use environment variables instead if you're trying to configure supabse from a config file. Can't give you a better answer without more contextsaeris
06/23/2022, 10:28 AMgetUserByCookie
and redirecting them if they don't, have you tried the withMiddlewareAuth
function from @supabase/auth-helpers-nextjs/middleware
instead? Because it provides the same functionality. Here's a usage example from the docs: https://github.com/supabase-community/auth-helpers/tree/main/packages/nextjs#protecting-routes-with-nextjs-middlewareGünhan
06/23/2022, 12:17 PMGünhan
06/23/2022, 12:33 PMgaryaustin
06/23/2022, 3:16 PMBicijay
06/23/2022, 3:41 PMconst verify = await supabase.auth.verifyOTP({
email: 'emailtest@gmail.com',
type: tokenType,
token: token
});
Object {
"error": Object {
"message": "Request Failed",
},
"session": null,
"user": null,
}
garyaustin
06/23/2022, 3:54 PMOlyno
06/23/2022, 4:17 PMZenon
06/24/2022, 6:35 AMZenon
06/24/2022, 6:40 AM@/config/index
is basically a configured module alias (https://nextjs.org/docs/advanced-features/module-path-aliases) (to import the index.js
file in the config
folder) in a jsconfig.json
file. I guess it uses the fs
module internally, perhaps that's what is causing the issue. I'll try with a standard import and see if that helps.Zenon
06/24/2022, 6:41 AMDevr
06/24/2022, 2:25 PMgaryaustin
06/24/2022, 2:39 PMDevr
06/24/2022, 6:04 PMgaryaustin
06/24/2022, 6:05 PMDevr
06/24/2022, 6:06 PMDevr
06/24/2022, 6:06 PMDevr
06/24/2022, 6:09 PMWalnutDevelop
06/24/2022, 6:11 PMWalnutDevelop
06/24/2022, 6:26 PMhatton
06/24/2022, 6:51 PMsaikksub
06/25/2022, 4:33 PMconst { user, session, error } = await supabase.auth.signIn({
provider: 'LinkedIn'
})
saikksub
06/25/2022, 4:33 PM{"code":400,"msg":"Unsupported provider: Provider is not enabled"}
saikksub
06/25/2022, 4:34 PMgaryaustin
06/25/2022, 4:41 PMsaikksub
06/25/2022, 5:38 PMgaryaustin
06/25/2022, 6:23 PMbattlesheep123
06/26/2022, 10:00 AMtylergannon
06/26/2022, 11:17 AMSettings -> API
. The one called anon / public
says "This key is safe to use in a browser if you have enabled Row Level Security for your tables and configured policies."
It looks like the idea is that in order to gain access to any data in your database, a user would have to have the ANON key as well as a valid JWT issued by Supabase. So you won't have a security issue unless your application is open to XSS, etc, which could cause a user's valid login token to leak to other systems.