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

basePath not working after updating to 10.0.8 #22843

Closed
violabg opened this issue Mar 7, 2021 · 2 comments · Fixed by #22879
Closed

basePath not working after updating to 10.0.8 #22843

violabg opened this issue Mar 7, 2021 · 2 comments · Fixed by #22879
Labels
bug Issue was opened via the bug report template.

Comments

@violabg
Copy link

violabg commented Mar 7, 2021

What version of Next.js are you using?

10.0.8

What version of Node.js are you using?

14

What browser are you using?

Chrome, Safari

What operating system are you using?

macOs 11.2.2

How are you deploying your application?

next start

Describe the Bug

I've updated to 10.0.8, and basePath stoped working I'm getting:

 http://localhost:3000/brand/it 404 (Not Found)
it:1 GET http://localhost:3000/brand/_next/static/chunks/main-093be8720c3bcc128712.js net::ERR_ABORTED 404 (Not Found)
it:1 GET http://localhost:3000/brand/_next/static/chunks/commons.1869cbd23f3f8cc4be00.js net::ERR_ABORTED 404 (Not Found)
it:1 GET http://localhost:3000/brand/_next/static/chunks/pages/_error-4c1af142aef0a484e71f.js net::ERR_ABORTED 404 (Not Found)
it:1 GET http://localhost:3000/brand/fonts/styles.css net::ERR_ABORTED 404 (Not Found)
it:25 GET http://localhost:3000/brand/_next/static/2tJDBmRSU0I806yikZrLc/_buildManifest.js net::ERR_ABORTED 404 (Not Found)
it:25 GET http://localhost:3000/brand/_next/static/2tJDBmRSU0I806yikZrLc/_ssgManifest.js net::ERR_ABORTED 404 (Not Found)
it:25 GET http://localhost:3000/brand/chat.js net::ERR_ABORTED 404 (Not Found)
it:25 GET http://localhost:3000/brand/brand-dark-bg.png 404 (Not Found)
it:25 GET http://localhost:3000/brand/_next/static/chunks/main-093be8720c3bcc128712.js net::ERR_ABORTED 404 (Not Found)
it:25 GET http://localhost:3000/brand/_next/static/chunks/commons.1869cbd23f3f8cc4be00.js net::ERR_ABORTED 404 (Not Found)
it:25 GET http://localhost:3000/brand/_next/static/chunks/pages/_error-4c1af142aef0a484e71f.js net::ERR_ABORTED 404 (Not Found)
it:25 GET http://localhost:3000/brand/_next/static/2tJDBmRSU0I806yikZrLc/_buildManifest.js net::ERR_ABORTED 404 (Not Found)
it:25 GET http://localhost:3000/brand/_next/static/2tJDBmRSU0I806yikZrLc/_ssgManifest.js net::ERR_ABORTED 404 (Not Found)
favicon-brand.ico:1 GET http://localhost:3000/brand/favicon/favicon-brand.ico 404 (Not Found)

Expected Behavior

to be able to load scripts via basePath

To Reproduce

/* eslint-disable @typescript-eslint/no-var-requires */
const dotenv = require("dotenv");
const fs = require("fs");
const path = require("path");
const nextTranslate = require("next-translate");

dotenv.config();
const domain = process.env["NEXT_PUBLIC_SERVER_DOMAIN"];
const secretCookiePassword = process.env["SECRET_COOKIE_PASSWORD"];
const endpoint = process.env.NEXT_PUBLIC_GQL_API_DOMAIN;
const dip = process.env.NEXT_PUBLIC_DIP_DOMAIN;
const trackingID = process.env.NEXT_PUBLIC_TRACKING_ID ?? "UA-190484440-1";
const brand = process.env.NEXT_PUBLIC_BRAND;
const isProd = process.env.NODE_ENV === "production";

module.exports = nextTranslate({
  basePath: isProd ? `/${brand}` : "",
  env: {
    NEXT_PUBLIC_SERVER_DOMAIN: domain,
    SECRET_COOKIE_PASSWORD: secretCookiePassword,
    NEXT_PUBLIC_BRAND: brand,
    NEXT_PUBLIC_GQL_API_DOMAIN: endpoint,
    NEXT_PUBLIC_DIP_DOMAIN: dip,
    NEXT_PUBLIC_TRACKING_ID: trackingID
  },
  images: {
    domains: ["mydomain.com"]
  }
});

it was working fine since 10.0.7. It still works on dev mode, but when I build and start the project either on localhost or on production server, it stop working.

I hade problem with environmental variable not been read on browser after updating to 10.0.8, that I solved by prefixing them with NEXT_PUBLIC_.

@violabg violabg added the bug Issue was opened via the bug report template. label Mar 7, 2021
@violabg
Copy link
Author

violabg commented Mar 8, 2021

it looks like it is solved in v10.0.9-canary.2

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants