Skip to content

Can't use next.js basePath configuration attribueΒ #905

@Twister42

Description

@Twister42

Hello,

first things first : i've made a project with all the latest version of next and supertokens to test this, so you can consider the current version as the one having an issue πŸ™‚

When you set a basePath for nextJs everything get prefixed and it messes up with Supertokens' paths.

If you set up a simple project with the following parameters nothing works :

export const appInfo = {
  appName: 'App',
  websiteDomain: 'http://localhost:3000',
  apiDomain:  'http://localhost:3000',
  apiBasePath: '/prefix/auth',
  websiteBasePath: "/prefix/auth",
};

next.config.ts :

const moduleExports = {
  basePath: '/prefix'
}

When messing with the appInfo, either you get blocked by a path filter in the backend ether you get redirected to /prefix/prefix/auth

 // if the prefix of the URL doesn't match the base path, we skip
if (!path.startsWith(this.appInfo.apiBasePath)) {
    (0, logger_1.logDebugMessage)(
        "middleware: Not handling because request path did not start with config path. Request path: " +
            path.getAsStringDangerous()
    );
    return false;
}

I can't find a way to make it work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions