blitz-js / next-superjson-plugin

SuperJSON Plugin for Next.js Pages and Components
192 stars 13 forks source link

Cannot start the app #74

Closed rawnly closed 1 year ago

rawnly commented 1 year ago

Verify Next.js canary release

Describe the bug

CleanShot 2023-03-15 at 01 48 07

Expected behavior

I'd like to run the app

Reproduction link

repository codesandbox link

Version

13.2.5-canary.3

Config

/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    appDir: true,
    swcPlugins: [["next-superjson-plugin", { debug: true }]],
  },
};

module.exports = nextConfig;

Additional context

No response

hect1c commented 1 year ago

This also happens with NextJS version 13.2.5-canary.4 I had to revert back to the following versions to get this working

RealGatt commented 1 year ago

Can also replicate. Causes a segmentation fault issue when building.

darthmaim commented 1 year ago

This is the related issue in the next.js repo: vercel/next.js#46989. It's not just this plugin.

mauriceackel commented 1 year ago

I ran into the same issue today. I got it working with:

I had to clear my .next folder to get it working after downgrading my NextJS version

elie222 commented 1 year ago

Same issue here. Commenting out the use of the plugin till resolved.

orionmiz commented 1 year ago

This appears to be an issue from the recent turbopack update (vercel/next.js#46971) There is nothing we can do on the plugin side, so please use a version of Next.js lower than 13.2.4 until the issue is resolved.

kevin-courbet commented 1 year ago

Even after pinning 13.2.3 and 0.5.6 (rm node_modules .next), I am still getting an error, albeit a different one. The dev server will start, but as soon as there is a render, I'll get this.

failed to invoke `.../node_modules/.pnpm/next-superjson-plugin@0.5.6_bybiisvvvxj62fig2dzdxxp2ea/node_modules/next-superjson-plugin/dist/next_superjson.wasm` as js transform plugin at .../node_modules/.pnpm/next-superjson-plugin@0.5.6_bybiisvvvxj62fig2dzdxxp2ea/node_modules/next-superjson-plugin/dist/next_superjson.wasm
    1: RuntimeError: unreachable
    2: unreachable', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/swc-0.245.27/src/plugin.rs:228thread '<unnamed><unnamed>' panicked at ':14' panicked at 'failed to invoke plugin: failed to invoke plugin on 'Some(".../src/app/layout.tsx")'

In the past 2 days I have tried various combinations of versions, going back to previous working commits (by deleting node_modules / .next), to no avail. Really puzzling...

For the time being, I just rolled out a quick and dirty serialization / deserialization utility /shrug.

ericwang401 commented 1 year ago

A workaround is to downgrade to next@13.2.0 and delete the .next folder and run your dev server. I was running next@13.2.4 and downgraded to that version and it worked.

totobest commented 1 year ago

I got it working:

darthmaim commented 1 year ago

The upstream issue in next.js was fixed in the latest canary, but plugins now need to update to the latest swc version.

orionmiz commented 1 year ago

It's been a long wait, everyone.

Please try next-superjson-plugin v0.5.7 with next canary.

arnaudriegert commented 1 year ago

Thank you @orionmiz

It works for me with next@13.3.1-canary.17 (not 13.3.0)

Also noteworthy that it seems I can serialize dates without the plugin on that canary version.

arashi-dev commented 1 year ago

next@13.3.1 is out now :) no need canary version anymore

Ashutsoh1729 commented 1 year ago

Hello, I am facing the error where i have used next@13.3.1 and next-superjson-plugin v 0.5.7 but it shows error

Here Is the error

error - ./node_modules/next/dist/client/dev/amp-dev.js Error: failed to process failed to invoke plugin: failed to invoke plugin on 'Some("/Users/ashutoshhota/Coding/web development/Next JS/Ongoing Projects/Messenger Clone/Messenger Clone/Messenger-Clone/node_modules/next/dist/client/dev/amp-dev.js")'

Caused by: 0: failed to invoke /Users/ashutoshhota/Coding/web development/Next JS/Ongoing Projects/Messenger Clone/Messenger Clone/Messenger-Clone/node_modules/next-superjson-plugin/dist/next_superjson.wasm as js transform plugin at /Users/ashutoshhota/Coding/web development/Next JS/Ongoing Projects/Messenger Clone/Messenger Clone/Messenger-Clone/node_modules/next-superjson-plugin/dist/next_superjson.wasm 1: RuntimeError: unreachable 2: unreachable

Please help

orionmiz commented 1 year ago

@Ashutsoh1729 Please update Next.js and plugin

Ashutsoh1729 commented 1 year ago

Thank you @orionmiz

I have now updated both to their latest versions and it worked. Thank you again.

sneko commented 5 months ago

I was having the same issue while using Next.js v14.1.0, my solution was to downgrade both next-superjson-plugin and so superjson (since using it directly) to have superson v1 used.

Here my package.json:

    "next-superjson-plugin": "0.5.10",
    "next": "14.1.0",
    "superjson": "^1.13.3",
michaeltrinh7 commented 3 months ago

It works. Thank you sneko