Hello, I'm getting the following error message: `...
# support-questions-legacy
a
Hello, I'm getting the following error message:
Copy code
{
  "error": "The middleware couldn't serve the API path /signin, method: post. If this is an unexpected behaviour, please create an issue here: https://github.com/supertokens/supertokens-node/issues"
}
Note¹: The /signup path works normally. Note²: I'm using the following recipes in order: Session, UserMetadata, UserRoles, PasswordLess, EmailPassword Can you tell me how I can diagnose this problem?
r
Hey! Can I see how you have used the middleware in your lambda function? And also how you are sending the request?
a
The middleware works fine on the Passwordless recipe routes... But now that I've added the Emailpassword recipe I'm getting error in the /signin route
r
whats the request that you are sending?
a
Lambda:
Copy code
import middy from '@middy/core';
import cors from '@middy/http-cors';
import { log } from 'i-logs';
import { errorResponse } from 'i-response-message';
import supertokens from 'supertokens-node';
import { middleware } from 'supertokens-node/framework/awsLambda';

import { handleAnyError } from '../../application/utils/exceptions';
import { getSuperTokensConfig } from '../supertokens/config';
import { ALLOW_HEADERS } from '../utils/corsResponse';

supertokens.init(getSuperTokensConfig());

export const authentication = middy(middleware())
  .use(cors({
    credentials: true,
    origin: getSuperTokensConfig().appInfo.websiteDomain,
    headers: ALLOW_HEADERS,
  }))
  .onError((response) => {
    log('ERROR:: authentication::', response.error);

    const handledError = handleAnyError(response.error);
    return errorResponse(handledError.statusCode, handledError);
  });
r
whats the request that you are sending?
a
Oh I read your question and I ended up finding the problem
r
oh haha! happens 🙂
a
I was sending "rid" header as "session" instead of "emailpassword"
r
gotcha!
a
I should have looked better for the error before contacting you, but thanks again!
r
well.. happy to help 🙂
11 Views