Skip to content
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

Next.js build fails on 22.6.1 #402

Closed
jfstn opened this issue Jan 11, 2025 · 5 comments · Fixed by #405
Closed

Next.js build fails on 22.6.1 #402

jfstn opened this issue Jan 11, 2025 · 5 comments · Fixed by #405

Comments

@jfstn
Copy link

jfstn commented Jan 11, 2025

Describe the bug
Updating @stacks/connect-react from 22.5.0 to 22.6.1 makes next build fail on page pre-rendering.

Expected behavior
Updating the minor version should still allow Next.js to build and pre-render the pages that were being pre-rendered before.

Running next build:

Error occurred prerendering page "/page". Read more: https://nextjs.org/docs/messages/prerender-error

ReferenceError: window is not defined
    at 58777 (/next/.next/server/chunks/634.js:156:63815)
    at t (/next/.next/server/webpack-runtime.js:1:143)
    at 92464 (/next/.next/server/chunks/40.js:30:33731)
    at t (/next/server/webpack-runtime.js:1:143)
    at 16219 (/next/server/chunks/40.js:30:37169)
    at t (/next/server/webpack-runtime.js:1:143)
    at 36501 (/next/.next/server/app/points/page.js:1:6100)
    at Object.t [as require] (/next/.next/server/webpack-runtime.js:1:143)
    at require (/next/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:18490)
    at I (/next/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:94362)
 ✓ Generating static pages (10/10)
@haardikk21
Copy link

haardikk21 commented Jan 20, 2025

+1
Also true for @stacks/connect at version 7.10.0

@martinsvinicius
Copy link
Contributor

Downgrading @stacks/connect to 7.8.0 and @stacks/connect-react to 22.5.0 worked for me.

I think the error is related to this Pull Request: #400

Looks like the entry point index.ts exports providers.ts, which executes initializeAsignaProvider that uses the window object without checking if it exists.

I'm willing to fix this if you prefer.

@jfstn
Copy link
Author

jfstn commented Feb 3, 2025

Downgrading @stacks/connect to 7.8.0 and @stacks/connect-react to 22.5.0 worked for me.

I think the error is related to this Pull Request: #400

Looks like the entry point index.ts exports providers.ts, which executes initializeAsignaProvider that uses the window object without checking if it exists.

I'm willing to fix this if you prefer.

Thanks for finding the root cause of the issue.

The question is not that much about downgrading but being unable to upgrade and therefore being unable to use apps via Asana iframe.

Would greatly appreciate if you could open a PR with a fix and mention this issue @martinsvinicius

@dev-araujo
Copy link

dev-araujo commented Feb 4, 2025

@martinsvinicius
Is this update already in the default lib via npm?
I reinstalled the lib in my next project and it still fails to build

Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
**ReferenceError: window is not defined**
    at 2096 (/home/dev-araujo/Documents/github/blockchain-projects/learnweb3/STACKS/account-history/.next/server/chunks/412.js:10:30909)
    at t (/home/dev-araujo/Documents/github/blockchain-projects/learnweb3/STACKS/account-history/.next/server/webpack-runtime.js:1:143)
    at 1629 (/home/dev-araujo/Documents/github/blockchain-projects/learnweb3/STACKS/account-history/.next/server/app/page.js:1:6809)
    at t (/home/dev-araujo/Documents/github/blockchain-projects/learnweb3/STACKS/account-history/.next/server/webpack-runtime.js:1:143)
    at 1508 (/home/dev-araujo/Documents/github/blockchain-projects/learnweb3/STACKS/account-history/.next/server/app/page.js:1:4184)
    at Object.t [as require] (/home/dev-araujo/Documents/github/blockchain-projects/learnweb3/STACKS/account-history/.next/server/webpack-runtime.js:1:143)
    at require (/home/dev-araujo/Documents/github/blockchain-projects/learnweb3/STACKS/account-history/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:131:7946)
    at u (/home/dev-araujo/Documents/github/blockchain-projects/learnweb3/STACKS/account-history/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:36:646)
    at F (/home/dev-araujo/Documents/github/blockchain-projects/learnweb3/STACKS/account-history/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:36:10477)
    at T (/home/dev-araujo/Documents/github/blockchain-projects/learnweb3/STACKS/account-history/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:36:8526)
Export encountered an error on /page: /, exiting the build.
 ⨯ Static worker exited with code: 1 and signal: null

@jfstn
Copy link
Author

jfstn commented Feb 4, 2025

@dev-araujo I don't manage the release process of the lib.

@janniks might be able to help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants