I just started getting these error messages: ``` No instance of EmailPassword found.```
f
I just started getting these error messages:
Copy code
No instance of EmailPassword found.
r
Hey @funk101 there are many reasons for this. You may be importing from the wrong SDK, might not be calling init, or may be calling the frontend functions from ssr backend. Please check all these
f
It's a new install, was working a second ago. Then I tried to modify the signin/up(you and I did this on another site a while ago). Started failing. I reverted back to original code and it seems like it's "cached" or something. I'm using nextjs
I'm gonna post the code here, ok?
r
Yess. I’m not sure. You’re gonna have to figure it out yourself. Especially since it was all working just sometime ago
If you have any specific questions, please feel free to ask.
f
Copy code
export const frontendConfig = () => {
  return {
    enableDebugLogs: false,
    appInfo,
    recipeList: [
      EmailPasswordReact.init({
        palette: {
          textPrimary: "#333366",
          textLabel: "#333366",
          textTitle: "#333366",
          textInput: "#333366",
        },
        style: {
          button: {
            backgroundColor: "#333366",
            border: "none",
          },
          headerTitle: {
            fontSize: "36px",
            fontWeight: "normal",
          },
        },
      }),
      SessionReact.init(),
    ],
    windowHandler: (oI) => {
      return {
        ...oI,
        location: {
          ...oI.location,
          setHref: (href) => {
            Router.push(href);
          },
        },
      };
    },
  };
};
what's this new "windowHandler" code?
r
It allows you to override how the SDKs interact with the window object
So here we tell the SDK to use NextJS router for navigation instead of doing a full page reload (which is the default)
f
I see, but can you see that this code is very basic. This is what worked before. I've tried trashing .next directory but when I run 'yarn build" it fails
r
It seems fine. Are you importing from web-js anywhere? Where is the error coming from? You should try and debug it yourself first. It’s usually a silly error when these things happen
Otherwise, I can try and help you sometime in the coming week
f
not using web-js
r
Hmm. maybe you are calling some function from auth-react during server side rendering?
It could also be if you are rendering one of our components without the NextJS’ dynamic HOC?
To disable server side rendering on our components
f
You here?
r
Hey! Did you try and debug?
f
Yeah, I ran some code sample and got it to work. However, not like I did last time. I was able to embed in a component, that just won't even render now. Seems there've been some changes to ST?
r
You should still be able to embed it as before
f
I get this error intermittenly when clicking signin
Copy code
Error: Cancel rendering route
r
Hmm
f
If I click on signin form shows, i hit the signin button again and I get that error
r
With the right credentials? Or even with wrong or empty credentials?
f
hang on I'm gonna rebuild
r
I think the issue is that you are navigating too soon? I’m not sure. Are you using NextJS 13?
f
yes
fresh install as of two days ago
r
I see. So this could be a new thing in NextJS
f
hmm
r
If you can open an issue about this, and post some code on how to replicate it, or give us access to the new code, we can check it out.
f
how do I do this?
r
GitHub
Open an issue on GitHub
In the supertokens-auth-react repo
f
I should post to my own github repo then open an issue on GitHub in that repo?
r
You can open an issue on our GitHub repo and steps on how to replicate this issue.
f
but I'm sure the need to see my code. frontend backend and component,right?
I can just put that in a repo and send link in your repo, right?
r
Yea u can
f
in your repo, what would I list this question as? Under "Issues"? -> Bug Report?
r
yea sure
whatever you like
f
Ok I posted there, should I post somewhere here?
r
no. this should be good enough. thanks
f
ok
I just commented out
Copy code
windowHandler: (oI) => {
      return {
        ...oI,
        location: {
          ...oI.location,
          setHref: (href) => {
            Router.push(href);
          },
        },
      };
    },
and it hasn't busted yet
r
meaning it works without that windowHandler?
f
so far
yeah, not busting now, hmm
r
hmm. Strange
f
This code
Copy code
signInPOST: async function (input) {
                if (originalImplementation.signInPOST === undefined) {
                  throw Error("Shouldn't come here");
                }
                try {
                  const response = await originalImplementation.signInPOST(
                    input
                  );
                  if (response.status === "OK") {
                    console.log("User2: ", response.user);
                    /* if (response.user) {
                      const currentAccessTokenPayload =
                        response.session.getAccessTokenPayload();
                      console.log("Payload: ", currentAccessTokenPayload);
                    } */
                  }
                } catch (err) {
                  console.log("signInPOST: ", err);
                }
is getting this error
Copy code
error - TypeError: Cannot read properties of undefined (reading 'status')
    at Object.<anonymous> (G:\Documents\Projects\LaCasting-NextJS\lacastinginc\node_modules\supertokens-node\lib\build\recipe\emailpassword\api\signin.js:67:20)
    at Generator.next (<anonymous>)
    at fulfilled (G:\Documents\Projects\LaCasting-NextJS\lacastinginc\node_modules\supertokens-node\lib\build\recipe\emailpassword\api\signin.js:29:36)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  page: '/api/auth/[[...path]]'
}
but the console.log(response.user) displays and user gets logged in
r
whats the response from the API call?
in the network tab
f
no response..?
internal server 500
r
right. So see why thats happening on your backend
f
yeah, but this code runs
Copy code
if (response.status === "OK") {
                    console.log("User2: ", response.user);
it logs user in console, so response.status must exist, no?
r
yea
f
...well I figured out the "can't read 'status' of undefined" error. All my commenting out and debugging I accidentally removed -> "return response". So, ..I hold my head in shame.
r
Ah right. Fair enough.
f
Sorry man
r
No worries. These types of errors r usually cause of mistakes like this. Hehe
f
I have a mergeIntoAccessTokenPayload question, should I post in main thread?
r
yea sure. Please post as another thread.
45 Views