You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a custom server with a custom page mapping breaks the application when using getInitialProps, it does work with getStaticProps
Unhandled Runtime Error
Error: The provided `as` value (/empty-component) is incompatible with the `href` value (/[lang]/empty-component). Read more: https://err.sh/zeit/next.js/incompatible-href-as
To Reproduce
While using SSR application with the current folder structure:
pages
[lang]
component.jsx
component.jsx
import React from 'react';
function Empty() {
return (
<>
</>
);
}
export const getInitialProps = function defaultGetProps(ctx) {
let locale = ctx.params.lang || 'en';
let lang = {};
return {
props: {
lang,
locale,
},
};
};
export default Empty;
And using a custom server to support default language routes:
Mapping /component -> /en/component (If the default language is en)
This discussion was converted from issue #14563 on June 26, 2020 13:11.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Bug report
Describe the bug
Using a custom server with a custom page mapping breaks the application when using
getInitialProps
, it does work withgetStaticProps
To Reproduce
While using SSR application with the current folder structure:
component.jsx
And using a custom server to support default language routes:
Mapping
/component
->/en/component
(If the default language is en)Mapping function called from Express
Expected behavior
It should not crash, and function the same was as with using getStaticProps
Screenshots
System information
Beta Was this translation helpful? Give feedback.
All reactions