nx: Nextjs 11.4.0 with next 10.0.7 version next.config not being used

Current Behavior

Right now i’m having issues with Vercel deploy due to the routes manifest but locally now nextjs config is not being used because i do use next/image component and it requires image domains and i have set all the domains and it doesn’t recognize, NOR env variables so i assume the file is not being used Nx each time i upgrade i do have issues and breaking changes or something does stop working, i’m not sure what happened but in fact next.config is not being process correctly

Expected Behavior

Load the file correctly, allow me to process a build and have all my env vars and image domains correctly

Steps to Reproduce

Simply install all latest versions except nextjs (use 10.0.7) and use Nextjs image component or even try to pass env variables

My next.config.js:

const { nextI18NextRewrites } = require('next-i18next/rewrites')
const localeSubpaths = {}
const withNx = require('@nrwl/next/plugins/with-nx')
module.exports = withNx({
	rewrites: async () => nextI18NextRewrites(localeSubpaths),
	publicRuntimeConfig: {
		localeSubpaths,
	},
	poweredByHeader: false,
	devIndicators: {
		autoPrerender: false,
	},
	env: {
		PUSHER_CLIENT_KEY: process.env.PUSHER_CLIENT_KEY,
		API_URL: process.env.NX_SERVERLESS
			? 'my-api-url'
			: process.env.API_URL,
	},
	images: {
		domains: [
			'localhost',
                          "s3 domains etc etc"
		],
	},
})

This issue may not be prioritized if details are not provided to help us reproduce the issue.

Failure Logs

in vercel I do have one

13:17:47.550 | Traced Next.js server files in: 34844.514ms
-- | --
13:17:47.553 | [Error: ENOENT: no such file or directory, lstat '/vercel/workpath0/dist/dist/apps/app/.next/routes-manifest.json'] {
13:17:47.554 | errno: -2,
13:17:47.554 | code: 'ENOENT',
13:17:47.554 | syscall: 'lstat',
13:17:47.554 | path: '/vercel/workpath0/dist/dist/apps/app/.next/routes-manifest.json'
13:17:47.554 | }
13:17:50.227 | Done with "package.json"

Now locally I have the fact that it does not load images throwing

Unhandled Runtime Error
Error: Invalid src prop (https://mys3url.amazonaws.com/etcetc) on `next/image`, hostname "mys3url.etcetc" is not configured under images in your `next.config.js`
See more info: https://err.sh/next.js/next-image-unconfigured-host

If i do print the process env, its empty even though i’m passing variables

Environment

Node : 14.15.5 OS : darwin x64 pnpm : 5.18.3

nx : 11.2.12 @nrwl/angular : Not Found @nrwl/cli : 11.4.0 @nrwl/cypress : Not Found @nrwl/devkit : Not Found @nrwl/eslint-plugin-nx : 11.4.0 @nrwl/express : Not Found @nrwl/jest : 11.4.0 @nrwl/linter : 11.4.0 @nrwl/nest : 11.4.0 @nrwl/next : 11.4.0 @nrwl/node : 11.4.0 @nrwl/react : 11.4.0 @nrwl/schematics : Not Found @nrwl/tao : 11.4.0 @nrwl/web : 11.4.0 @nrwl/workspace : 11.4.0 typescript : 4.0.7

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 25 (11 by maintainers)

Most upvoted comments

thanks for the update! so hopefully the upcoming version of Nx will solve all of these problems and allow you to use latest Nx and Next (10.0.9) together 🤞

I can confirm that this is still broken in nx 12