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

deploy failed on vercel #4303

Closed
gengjiawen opened this issue Feb 21, 2024 · 15 comments · Fixed by #4311
Closed

deploy failed on vercel #4303

gengjiawen opened this issue Feb 21, 2024 · 15 comments · Fixed by #4311
Assignees

Comments

@gengjiawen
Copy link
Contributor

gengjiawen commented Feb 21, 2024

Repro: https://github.com/gengjiawen/blitzjs-demo
Image:
CleanShot 2024-02-21 at 21 50 13@2x

          @gengjiawen can you open an issue for this? I can't help without more information or a repro. Thanks!

Originally posted by @siddhsuresh in #4299 (comment)

@gengjiawen
Copy link
Contributor Author

@siddhsuresh Can you take a look, thx.

@gengjiawen
Copy link
Contributor Author

gengjiawen commented Feb 23, 2024

remove eval works for me. My guessing is that eval won't compatible with minifier.

@tordans
Copy link
Contributor

tordans commented Feb 23, 2024

@gengjiawen can you be a bit more specific? Thanks!

We are also having this problem...

@gengjiawen
Copy link
Contributor Author

patch node modules like this (I am using pnpm)

diff --git a/dist/chunks/auth-plugin.cjs b/dist/chunks/auth-plugin.cjs
index beef77a9f480f095381f176b0da5a3c77c4ee25e..dff1216e3f4c6cacc2ba0e05d12254e56679e471 100644
--- a/dist/chunks/auth-plugin.cjs
+++ b/dist/chunks/auth-plugin.cjs
@@ -162,7 +162,7 @@ function getSession(req2, res2, appDir = false) {
 function getBlitzContext() {
   return __async$1(this, null, function* () {
     try {
-      const { headers, cookies } = eval("require('next/headers')");
+      const { headers, cookies } = require('next/headers');
       const req = new http.IncomingMessage(new net.Socket());
       req.headers = Object.fromEntries(headers());
       const csrfToken = cookies().get(index.COOKIE_CSRF_TOKEN());
@@ -201,7 +201,7 @@ function useAuthenticatedBlitzContext(_0) {
     const ctx = yield getBlitzContext();
     const userId = ctx.session.userId;
     try {
-      const { redirect } = eval("require('next/navigation')");
+      const { redirect } = require('next/navigation');
       if (userId) {
         debug("[useAuthenticatedBlitzContext] User is authenticated");
         if (redirectAuthenticatedTo) {

@siddhsuresh
Copy link
Member

thanks for the issue @gengjiawen! I will take a look today.

Does this happen locally for you? Since I am no longer able to replicate this after the latest fix.

@gengjiawen
Copy link
Contributor Author

Does this happen locally for you

If you refer to the deploy issue, The deploy issue only happens on nextjs. My local yarn start works.

@siddhsuresh
Copy link
Member

okay thanks for the info. will keep that in mind and debug

@cfragkos
Copy link

cfragkos commented Mar 8, 2024

probably related to #4309. Please fix it fast

@gengjiawen

This comment was marked as outdated.

@siddhsuresh
Copy link
Member

@gengjiawen where is getBlitzContext being imported from? if you are importing from "@blitz/auth" instead import it from "app/blitz-server"

@gengjiawen
Copy link
Contributor Author

gengjiawen commented Mar 11, 2024

@gengjiawen where is getBlitzContext being imported from? if you are importing from "@blitz/auth" instead import it from "app/blitz-server"

import from blitz-server will result in build error.

Attempted import error: 'setupBlitzServer' is not exported from '@blitzjs/next' (imported as 'setupBlitzServer').

adding a new issue: #4310

This was referenced Mar 11, 2024
@gengjiawen
Copy link
Contributor Author

gengjiawen commented Mar 13, 2024

since this has been 3 weeks, I have created #4311 to fix this issue.
This fix all the issues I run into in productions.

@flybayer
Copy link
Member

Hey folks, we have investigated, can reproduce, but so far are unable to understand what is happening on Vercel.

Are any of you able to reach out to Vercel support and enlist their help?

@cfragkos
Copy link

cfragkos commented Mar 20, 2024

Yes I am in contact, and got them to investigate, they were quick to blame the 3rd party dependency, but I pressed them after investigating the source code that the way you import and use debug is not wrong and it's their problem, so it seems they will look into it, I suggest you also reach out because you have more technical knowledge to explain than me

@cfragkos
Copy link

Got my answer today

Hi again,

Thank you for waiting. I have reviewed this issue with our team's framework-related expert and can confirm that investigating why the "debug" package is not working on Next.js 14 would require implementation-level debugging which is not in the purview of this support team.

The Blitz.js repo is the best place for this, so, that you're able to get support from framework developers and maintainers.

If there are any other platform-related Qs or issues that you may have, do let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

6 participants