Effect CommunityEC
Effect Community6mo ago
1 reply
Toyo

console.log and Effect.log not showing

console.log('handler file')

const security = HttpApiSecurity.apiKey({
    // Specify that the API key is stored in a cookie
    in: "cookie",
    // Define the cookie name,
    key: "wos-session"
})




export const AuthApiGroupLive = HttpApiBuilder.group(Api,
    'AuthApiGroup',
    (handlers) => Effect.gen(function* () {
        const { workos, authenticateWithCode } = yield* Auth;

        return handlers.handle(
            "login",
            () => Effect.gen(function* () {
                console.log('in login handler')

                const authorizationUrl = workos.userManagement.getAuthorizationUrl({
                    // Specify that we'd like AuthKit to handle the authentication flow
                    provider: 'authkit',

                    // The callback endpoint that WorkOS will redirect to after a user authenticates
                    redirectUri: 'http://localhost:3007/callback',
                    clientId: env.WORKOS_CLIENT_ID,
                });


                HttpServerResponse.empty().pipe(
                    Effect.tap(Console.log("Accessing the secret section ..."))
                )


                yield* Effect.log(`authUrl: ${authorizationUrl}`)

                // Redirect the user to the AuthKit sign-in page
                return HttpServerResponse.redirect(authorizationUrl)
            })

        )

I see the first
console.log
outside the HttpApiBuilder.group() call. But all my logs inside that are being swallowed. I have tried everything I can think of, even copying code directly from the Effect platform README. Any help would be greatly appreciated.
Was this page helpful?