-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaks with latest version of remark-gfm; unhelpful error message #403
Comments
I confirm having the same issue, a simple MDX with an inline code triggers the error message. |
I have the same plugin but i use bright as a wrapper around and the and I have no issues with having |
Confirming, same issue. |
I can confirm this solution works, good catch! The error appeared for me no matter what GFM component I used, although I first noticed after trying to add tables. |
In addition to the error which appears in the browser window, an error is also printed in the console, although it doesn't yield any additional useful info:
|
I also get this error if there is a table in the markdown. The solution to use v3 works for me for tables and back-ticks. |
Is this somewhat going to be addressed by the maintainers here? As the last release was in March. |
Some feedback, reverting 3.0.1 resolves the issue I noticed that this happen when trying to parse Tables, but specifically, tables with headers. | a | b | c | d | | - | - | - | - | | a | b | c | d | if the hyphens row is included this throw error of | a | b | c | d | | a | b | c | d | if the hyphens row is NOT included doesn't throw the error but doesn't parsed it either |
Same here, reverting remark-gfm to v3.0.1 resolves the issue. |
The problem is in https://github.com/syntax-tree/mdast-util-gfm-table/ lib/index line 79 and line 89 the problem is because this.data is undefined while trying to update the prop inTable this is just a fix, but it breaks the build, apparently 'CompileContext' is supposed to initialize this.data, but it isn't. Error: lib/index.js(79,8): error TS2339: Property 'setData' does not exist on type 'CompileContext'. Can someone give me feedback about 'CompileContext'? |
FYI this issue is already solved on all upstream libraries. Problem is, |
|
I downgraded |
I'm using next@14.0.4 and this works for me. Thanks! |
Not sure if this is related, but we faced a similar problem when using |
* fix(deps): update remark * fix(mdx): switch to forked next-mdx-remote supporting MDXv3 See hashicorp/next-mdx-remote#403 and hashicorp/next-mdx-remote#419. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: sabertazimi <sabertazimi@gmail.com>
Same issue. This is what I had:
|
Downgrading
(For reference, I'm using Storybook with gfm in my MDX files and am following their official guide for adding gfm support) |
Same issue here, reverting remark-gfm to v3.0.1 resolves the issue. But I don't like having outdated libraries. |
I also confirm rolling back to v3.0.1 works, still we need a fix for the v4 as well :// |
Bumping it as we still need a proper fix |
For anyone landing on this page, the issue has been acknowledged in a discussion thread and a fix is on its way. See #437. |
- hashicorp/next-mdx-remote#403 - to deal with this issue, remark-gfm is downgraded to 3.0.1
Another update from @dstaley: Canary releases of v5 are now available (check out the first comment by the bot to get the latest published canary version): |
As an additional note for anyone trying to use For instance, when I tried using TL;DR |
@jbukuts Definitely give the canary release of v5 a shot! Should be much smoother sailing. |
I believe I'm having a similar issue, but was hoping you might help me sanity check my thinking here. For my Next.js app, I'm using Obscure error message in the browser as it gets caught in an infinite error loop for all MDX files: When I remove the Does this sound at all plausible, or am I completely off base here? Here's my
|
@dstaley any docs on how to use a canary release? I haven't (knowingly) used one, but I'm hoping it might fix the issue I've just described above |
@paigen11 open the "Published 1 packages" on this comment: Inside you'll find the version that you can add to your |
@karlhorky thanks very much - the canary release seems to have fixed my issue! I now have two follow up questions for you:
For reference, I am still using the Next.js |
@paigen11 I'm aiming to release v5 sometime this month, and hearing that it fixes your issue is a great thing to hear! As for |
@snypiie if you're using import { GetStaticPaths, GetStaticProps, GetStaticPropsContext } from "next";
import { serialize } from "next-mdx-remote/serialize";
import { MDXRemote, MDXRemoteSerializeResult } from "next-mdx-remote";
import gfm from "remark-gfm";
// other imports here to fetch blog content (irrelevant to this example)
const BlogPostPage = ({ post, mdxSource }: BlogPostPageProps) => (
<>
<BlogPostContent post={post}>
<MDXRemote {...mdxSource} components={MDXComponentMap} />
</BlogPostContent>
</>
);
export const getStaticPaths: GetStaticPaths = async () => {
// code to figure out blog slug URLs
};
export const getStaticProps: GetStaticProps = async ({
params,
}: GetStaticPropsContext) => {
const { slug } = params as Params;
const post = await getBlogArticleFromSlug(slug);
const mdxSource = await serialize(post.content, {
mdxOptions: { remarkPlugins: [gfm] },
});
return {
props: {
post,
mdxSource,
},
};
};
export default BlogPostPage; The part to focus on is the
|
Is this issue fixed yet or not because i would like to update my package to latest version but i could not because of this issue. |
@adityaptikao I believe this issue should be fixed with v5 @dstaley if I'm correct about this being resolved with v5, should this issue be closed now? |
Since v4 remark-gfm has worked for me after upgrading NextJS from 14.0 to 14.2. @adityaptikao you can just try it and if it doesn't work for you just delete that git branch. |
I had this same issue using Next.js 14.2, react-remark and react-gfm. All devices on iOS 16 were crashing when rendering markdown. I solved it by overriding this package manually in my package.json to 2.0.0. Using pnpm:
|
This setup works
|
I'm not really sure where to file this, but:
I just started using
next-mdx-remote
, and everything was working fine until I added theremark-gfm
plugin. This is the entire error I was getting, with no further information:After some trial and error, I narrowed the issue down to inline
code
blocks -- I only get the error when they're present.After a bit more flailing I figured out that
remark-gfm
released version 4.0 a few days ago, which usesremark-parser
v11, while@mdx-js/mdx
usesremark-parser
v10. Rollingremark-gfm
back to version 3.x fixed the issue.I've made a minimal repro here:
https://codesandbox.io/p/github/HerbCaudill/next-mdx-remote-vs-remark-gfm
I'd assume whatever needs to be fixed is not in this library but somewhere upstream; noting the solution here in case it helps anyone.
However I would suggest revisiting the error formatter in
format-mdx-error.ts
. For some reason it removes the stack trace before throwing MDX formatting errors, which made this very difficult to debug. I can't imagine what the reason for doing that would be.next-mdx-remote/src/format-mdx-error.ts
Lines 58 to 66 in 4b2c128
The text was updated successfully, but these errors were encountered: