white-cartoon-58880
03/01/2022, 4:09 PM[...paths].ts
type catch-all routes doesnt seem to catch all routes, like they do in next.js
Anyone have any experience with trying to integrate https://github.com/ory/integrations/blob/main/src/next-edge/index.ts with plain vercel ?proud-plumber-24205
03/02/2022, 1:14 PMwhite-cartoon-58880
03/02/2022, 1:36 PMwhite-cartoon-58880
03/02/2022, 1:36 PMwhite-cartoon-58880
03/02/2022, 1:38 PMwhite-cartoon-58880
03/02/2022, 3:15 PMcurl <http://localhost:3000/api/ory/x>
is being catched, but request like:
curl <http://localhost:3000/api/ory/x/y>
gives 404proud-plumber-24205
03/02/2022, 4:57 PMhigh-optician-2097
/api/.ory/*
basically, this is what [...paths]
. As Alano said we don’t know really how this works for the framework you usehigh-optician-2097
white-cartoon-58880
03/02/2022, 4:59 PMwhite-cartoon-58880
03/02/2022, 5:01 PMhigh-optician-2097
high-optician-2097
white-cartoon-58880
03/02/2022, 5:02 PMhigh-optician-2097
high-optician-2097
white-cartoon-58880
03/02/2022, 5:04 PMvercel dev
then the serverless functions runs on local machine alsowhite-cartoon-58880
03/02/2022, 5:04 PMhigh-optician-2097
curl <http://localhost:3000/api/.ory/self-service/recovery/browser>
high-optician-2097
white-cartoon-58880
03/02/2022, 5:05 PMhigh-optician-2097
white-cartoon-58880
03/02/2022, 5:07 PMwhite-cartoon-58880
03/02/2022, 5:07 PMwhite-cartoon-58880
03/02/2022, 5:10 PMvercel dev
white-cartoon-58880
03/02/2022, 5:11 PMhigh-optician-2097
white-cartoon-58880
03/02/2022, 5:11 PMwhite-cartoon-58880
03/02/2022, 5:12 PMhigh-optician-2097
[...path]
does not work eitherwhite-cartoon-58880
03/02/2022, 5:13 PMwhite-cartoon-58880
03/02/2022, 5:14 PMhigh-optician-2097
high-optician-2097
high-optician-2097
high-optician-2097
next/server
high-optician-2097
white-cartoon-58880
03/02/2022, 5:21 PMwhite-cartoon-58880
03/02/2022, 5:21 PMwhite-cartoon-58880
03/02/2022, 5:22 PMhigh-optician-2097
white-cartoon-58880
03/02/2022, 5:24 PMhigh-optician-2097
white-cartoon-58880
03/02/2022, 5:25 PMhigh-optician-2097
white-cartoon-58880
03/02/2022, 5:26 PMwhite-cartoon-58880
03/02/2022, 5:27 PMhigh-optician-2097
high-optician-2097
white-cartoon-58880
03/02/2022, 5:32 PMwhite-cartoon-58880
03/02/2022, 5:35 PMwhite-cartoon-58880
03/02/2022, 5:35 PMwhite-cartoon-58880
03/02/2022, 5:47 PMhigh-optician-2097
white-cartoon-58880
03/02/2022, 6:09 PMwhite-cartoon-58880
03/02/2022, 6:11 PMreq.url.replace('/api/.ory/', '')
instead of req.paths.join('/')+search.toString()
white-cartoon-58880
03/02/2022, 6:12 PMpaths
variable doesnt contain path herewhite-cartoon-58880
03/02/2022, 6:25 PM// @ory/integrations offers a package for integrating with NextJS.
import { config, createApiHandler } from '@ory/integrations/next-edge';
// We need to export the config.
export { config };
const ah = createApiHandler({
fallbackToPlayground: true,
});
const apiHandlerWrapper = (req, res) => {
req.query.paths = req.url.replace(/^\/api\/.ory\//, '').split('?')[0];
ah(req, res);
};
export default apiHandlerWrapper;
white-cartoon-58880
03/02/2022, 6:45 PMhigh-optician-2097
white-cartoon-58880
03/03/2022, 5:12 PMreq.query.paths
to look like it does when you have a [...paths].ts
catchall file in next.js.
But the vercel serverless functions are pretty much 99.99% equal to next.js functions.
So it's the netlify integration that will need a lot of refactoring of the ory-integration code.