@@ -1065,6 +1065,16 @@ describe('SSG Prerender', () => {
1065
1065
await killApp ( app )
1066
1066
} )
1067
1067
1068
+ it ( 'should work with firebase import and getStaticPaths' , async ( ) => {
1069
+ const html = await renderViaHTTP ( appPort , '/blog/post-1' )
1070
+ expect ( html ) . toContain ( 'post-1' )
1071
+ expect ( html ) . not . toContain ( 'Error: Failed to load' )
1072
+
1073
+ const html2 = await renderViaHTTP ( appPort , '/blog/post-1' )
1074
+ expect ( html2 ) . toContain ( 'post-1' )
1075
+ expect ( html2 ) . not . toContain ( 'Error: Failed to load' )
1076
+ } )
1077
+
1068
1078
it ( 'should not cache getStaticPaths errors' , async ( ) => {
1069
1079
const errMsg = / T h e ` f a l l b a c k ` k e y m u s t b e r e t u r n e d f r o m g e t S t a t i c P a t h s /
1070
1080
await check ( ( ) => renderViaHTTP ( appPort , '/blog/post-1' ) , / p o s t - 1 / )
@@ -1088,7 +1098,21 @@ describe('SSG Prerender', () => {
1088
1098
} )
1089
1099
1090
1100
describe ( 'serverless mode' , ( ) => {
1101
+ const blogPagePath = join ( appDir , 'pages/blog/[post]/index.js' )
1102
+ let origBlogPageContent
1103
+
1091
1104
beforeAll ( async ( ) => {
1105
+ // remove firebase import since it breaks in legacy serverless mode
1106
+ origBlogPageContent = await fs . readFile ( blogPagePath , 'utf8' )
1107
+
1108
+ await fs . writeFile (
1109
+ blogPagePath ,
1110
+ origBlogPageContent . replace (
1111
+ `import 'firebase/firestore'` ,
1112
+ `// import 'firebase/firestore'`
1113
+ )
1114
+ )
1115
+
1092
1116
await fs . writeFile (
1093
1117
nextConfig ,
1094
1118
`module.exports = { target: 'serverless' }` ,
@@ -1106,7 +1130,10 @@ describe('SSG Prerender', () => {
1106
1130
distPagesDir = join ( appDir , '.next/serverless/pages' )
1107
1131
buildId = await fs . readFile ( join ( appDir , '.next/BUILD_ID' ) , 'utf8' )
1108
1132
} )
1109
- afterAll ( ( ) => killApp ( app ) )
1133
+ afterAll ( async ( ) => {
1134
+ await fs . writeFile ( blogPagePath , origBlogPageContent )
1135
+ await killApp ( app )
1136
+ } )
1110
1137
1111
1138
it ( 'renders data correctly' , async ( ) => {
1112
1139
const port = await findPort ( )
0 commit comments