GithubHelp home page GithubHelp logo

Comments (12)

briardg avatar briardg commented on September 26, 2024 3

@jtparrett I have found a way around the issue in case you are interested.

I thought it was weird that in the loader it works but not in the action,
So I dived inside Clerk code and realized they kind of piggy bag on our request.

So I tried to recreate a request that should work basically like in Loaders a get request with headers as this is where the Auth information is saved.

const generateNewRequestForClerk = (request: Request) => {
  const originalRequest = request.clone();
  const newRequestInit = {
    method: "GET", // Change the method to GET
    headers: new Headers(originalRequest.headers), // Copy headers from the original request
  };

  // Remove content-type header as it's not needed for GET and may cause issues
  newRequestInit.headers.delete("Content-Type");

  // Instantiate the new request without the body attribute
  return new Request(originalRequest.url, newRequestInit);
};


  const auth = await getAuth({
    ...args,
    request: generateNewRequestForClerk(args.request),
  });

Try it out and please tell me if it is working on your side too? 🙏

from javascript.

LekoArts avatar LekoArts commented on September 26, 2024 3

This was fixed with #3495 👍

from javascript.

ainoya avatar ainoya commented on September 26, 2024 3

Hello. I'm using clerk/remix on Cloudflare Pages, and when using getAuth within an ActionFunction, it seems to generate a new error from the code that was fixed in the PR #3495 🤔 The workaround provided seems to prevent the error from occurring.

TypeError: Cannot set property duplex of #<_Request> which has only a getter
    at patchRequest (.../node_modules/@clerk/remix/dist/ssr/utils.js:115:26)

from javascript.

octoper avatar octoper commented on September 26, 2024 3

Hey!

We have released a fix for the regression that was introduced in #3495, you can upgrade to the latest version of the Remix SDK and it will be resolved!

from javascript.

jtparrett avatar jtparrett commented on September 26, 2024 1

briardg

Thanks for this! Yes, that fix also worked in my case 👍 using it as a workaround for now.

from javascript.

frago12 avatar frago12 commented on September 26, 2024 1

@briardg thank you for the workaround, worked well on my end too

from javascript.

briardg avatar briardg commented on September 26, 2024

Hello,

I have the same issue, and it is not happening inside the Remix Loader but only in the action.

My version of node is the same.

I also added the Vercel recommendation using @vercel/remix instead of @remix-run/node
and vite config import { vercelPreset } from "@vercel/remix/vite";

But nothing helped

from javascript.

LekoArts avatar LekoArts commented on September 26, 2024

@octoper will look into this!

from javascript.

briardg avatar briardg commented on September 26, 2024

@octoper will look into this!

I can be available for any live coding meeting if needed

from javascript.

arminnaimi avatar arminnaimi commented on September 26, 2024

Hello. I'm using clerk/remix on Cloudflare Pages, and when using getAuth within an ActionFunction, it seems to generate a new error from the code that was fixed in the PR #3495 🤔 The workaround provided seems to prevent the error from occurring.


TypeError: Cannot set property duplex of #<_Request> which has only a getter

    at patchRequest (.../node_modules/@clerk/remix/dist/ssr/utils.js:115:26)

I just started a new project two days ago and I get the same error running on regular Node.js.

from javascript.

nsb avatar nsb commented on September 26, 2024

This was fixed with #3495 👍

But this unfortunately introduced a regression. Discussion on Discord here https://discord.com/channels/856971667393609759/1253975184818573313

@arminnaimi I have reported this bug. Hopefully they will fix it soon. In the meantime you can just downgrade to the previous version of @clerk/remix.

from javascript.

octoper avatar octoper commented on September 26, 2024

Thanks you for reporting that I will take a look at it today!

from javascript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.