#{"exists": false} after adding a new auth plugin in medusa-plugins.

23 messages · Page 1 of 1 (latest)

solid fern
#

I am contributing to the medusa-aith-plugins repo by adding a new auth provider (Keycloak) but I get the above error when testing.
Does anyone know what the error means and how to debug it ? Console.logs / breakpoints don't work. PR and link to repo (https://github.com/adrien2p/medusa-plugins/pull/65 and https://github.com/ianchikwature/medusa-plugins/tree/keycloak)

GitHub

Keycloak Open source Auth0 alternative
Uses passport-oauth2 as the passport strategy

#

Hi @deft zephyr , not sure if you can help or provide any pointers ^.

deft zephyr
#

Bey @solid fern , first of all thanks a lot for this contribution 😍

Could you tell me which version of medusa your are using to test?

solid fern
#

thanks and I am using 1.7.14.

deft zephyr
#

You have to move to 1.7.6+ otherwise the passport version miss match and therefore there is 2 different passport and the strategies does not get registered in the one used by medusa

#

Oups sorry i miss read 😂

#

I can see that you linked the package. Have you started using a custom entry point in order to be able to use —preserve-symlinks? Otherwise you don’t use the right package but the dev deps installed in your local package.
If you want to avoid the step above, you can pack the lib and install it

solid fern
#

@deft zephyr I tried packing it like you suggested, moved the tgz into a tmp folder in my medusa dir, it installed without any issues but I still get the same error "exists:false" even for google which I didn't touch.

deft zephyr
#

How did you configured it in your medusa-config?

solid fern
deft zephyr
#

Your authPath and authCallbackPath are the same for google and keycloak. One will override the other one. Could you change that?

#

Also, once you ve changed that, could you tell me if in your node_modules/medusa-plugin-auth/node_modules there is a passport package. It should not be present but I just want to be sure

solid fern
#

@deft zephyr Fixed that issue no change and strange, passport isn't in the node_modules

deft zephyr
#

This is normal that it is not in the node module. It is a peer deps,

#

Also don’t forget to fix your config 👍

solid fern
#

I fixed the config (authPath and authCallbackPath), I still get the same issue

deft zephyr
solid fern
#

@deft zephyr I think I found the issue, it's failing here https://github.com/adrien2p/medusa-plugins/blob/main/packages/medusa-plugin-auth/src/loaders/index.ts#L4 , it errors saying it can't find dist/loaders . Here's the error, I think require("../auth-strategies/google") points it to dist/loaders instead. Any ideas ?

GitHub

A collection of awesome plugins for medusa :rocket: - medusa-plugins/index.ts at main · adrien2p/medusa-plugins

deft zephyr
#

Nothing in the strategy is pointing toward the loaders 🤔

deft zephyr
#

When you go to the next bp what do you get?

solid fern
#

It fails with this (screenshot attached) because it can't find it. There is a warning in the process console, it says Running loader failed: Class extends value undefined is not a constructor or null

#

this is where it fails

deft zephyr
#

I can't see the errors entirely in the screen shots