This message was deleted.
# general
m
This message was deleted.
p
w
I don't think so, my requests are going exactly where I want them to go. I have the client wet up as:
Copy code
export const ory = new V0alpha2Api(
    new Configuration({
        basePath: process.env.ORY_SDK_URL,
        baseOptions: {
            withCredentials: true,
        },
    }),
);
And I can see in network that the url is correct. But when using any method at all, it returns what it should but throws a network error. Is it possible that in
@ory/integrations
something is being done to manipulate the request? Maybe this is cookie-related? The error is too generic, just a regular network error.
p
Maybe they are CORS related then. the
@ory/integrations
package creates a reverse proxy inside your application. so it's the same as running the
ory tunnel / proxy
Are you using the cloud?
w
self hosted
kratos
We are trying to move to SSG so we cannot use the nextjs proxy abilities
p
Maybe you haven't setup CORS on Kratos and the issue is actually a CORS error
sometime the browser doesn't clearly show this
which errors are you getting the browser console?
w
😐
like i said, the most generic network error
p
yes CORS errors produce generic network errors. but depending on the browser you use it also adds some context specific to CORS
w
Well we enabled CORS on kratos for our domain, as well as vercel and localhost
And like I said, this error doesn't happen when using the nextjs proxy
p
Okay, so you are currently testing out the SSG on your localhost while Kratos is hosted under your domain? meaning the baseURL you are setting is pointing to a remote resource?
w
yes it is
it has been the entire time and never posed an issue though
p
this might be the problem tho. since the ory integrations is creating a proxy on your local machine which mirror kratos.
and you have now removed that. so the browser doesn't like it and is rejecting the request
w
i see... but then... how do i develop locally? 😕
p
e.g. you can call kratos from your local machine fine with cURL, but the browser doesn't like this so it drops the network call.
you need to be running kratos on your local machine - or use the
ory tunnel
🤔 i also don't think we support developing against self-hosted kratos with
ory tunnel
. It's sort of a tool for Ory cloud
w
then what am i supposed to do? we don't have a production environment yet, my only environment is on vercel while kratos is hosted somewhere on k8s
p
you could follow something similar to this https://github.com/ory/cli/issues/188
w
i will give this a look
perhaps you have some idea of how to mimic the
integrations
thing statically with axios and give the axios instance to the ory client?
p
Well you can run your own reverse proxy which mirrors your instance of Ory Kratos. The
integrations
does this but inside the same
node
app. Since
node
is run on your machine and not "inside" the browser it can call any remote resource, so your browser is calling the node app which is on the same domain e.g. localhost
it's not possible to do this inside the browser
It seems you can actually set one of these
environment
variables to point the
ory tunnel
to your own Kratos instance https://github.com/ory/cli/blob/a9d6512b84d805b694ba1b4bd3d60f1616608bf2/cmd/cloudx/proxy/cmd_proxy.go#L229-L231
Copy code
const envVarSlug = "ORY_PROJECT_SLUG"
const envVarSDK = "ORY_SDK_URL"
const envVarKratos = "ORY_KRATOS_URL"
basically you will point your SDK inside the SSG to the
ory tunnel
running on http://localhost:4000 and the tunnel will point to your Kratos instance https://your-domain.xyz
this is a local development setup and is not needed when you deploy to vercel (unless vercel isn't on the same domain as your k8s)
w
it is not
eventually everything will be on k8s but... well...
p
no i mean with the
ory tunnel
it is only needed for the local setup
and it will work
w
i understand that
but i'm saying that the app is deployed on vercel, and ory on k8s, so i'm gonna have the same problem there
right?
p
not unless you have vercel configured to your domain
and k8s
so e.g. vercel is hosted on
auth.<your-domain>.com
k8s is hosted on
kratos.<your-domain>.com
and the cookie is set to
<your-domain>.com
w
This is indeed our current setup, but vercel also holds branch deployments for us which have a different domain, so we have to see what we do about those.
p
hmm yeah, with the branch deployments it might become tricky
v
Hey Ronny, this is Stephan from Ory and I am looking at you coms with Alano. Have you ever considered using Ory Cloud for your use case? There are several advantages in doing so: a) much faster deployment b) less effort to maintain c) continuous security updates d) no lock-in and much more. We believe it might the easiest way to overcome your issues. Let me know if you want to talk about it and schedule a call here: https://meetings-eu1.hubspot.com/stephan-reinartz
🙌 1
w
Hello Stephen, thank you for reaching out. My situation is that I had Ory imposed upon me and I had no say in the matter. I am a frontend developer and am consistently finding hiccups in integrating Ory with our app, but I have no power to decide what system we use. I have no idea why my company chose to use self-hosted over cloud. If it's okay, I could forward this message to our devops guy who is in charge of handling Ory for us. Or you can perhaps contact him directly @crooked-portugal-29682, he is in this server. Thank you.