Firebase 托管重写不适用于非 us-central1 区域
Firebase Hosting re-writes not working on non-us-central1 region
我已经将 next.js 应用程序部署到 Google 云端,并且正在使用 Functions 和 Hosting。
我最近尝试将所有内容移动到 northamerica-northeast1
区域。我重新部署了所有函数,将 .region("northamerica-northeast1")
放在我所有函数的开头,如图 here 所示。这成功更新了我所有函数的位置。
不过,我还使用一个函数来为我的 next.js 应用程序提供服务:
const server = functions.https
.onRequest((request, response) => {
return app.prepare().then(() => handle(request, response));
});
然后我重写了这个函数的所有 URL:
"hosting": {
"target": "webapp",
"public": "public",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"function": "nextjs-server"
}
]
},
这都是 Google 云上的标准 next.js,我已经做了 2 年多了。但是,当我使用以下方法将函数移动到新区域时:
const server = functions
.region("northamerica-northeast1")
.https
.onRequest((request, response) => {
return app.prepare().then(() => handle(request, response));
});
重写似乎不再有效。该功能已更新,但当我访问该站点时,我收到 404。然后,当我将该功能移回默认区域(通过删除 .region())时,它再次正常工作。
我尝试了 3 个当前项目,同样的事情。
最后,我尝试创建一个全新的项目并部署到 northamerica-northeast
区域(和以前一样)并使用其中的区域代码推送功能......所以我的项目从来没有托管在 northamerica-northeast1
以外的任何地方,但仍然失败。但是,通过删除该区域,重写再次开始正常工作,我可以看到该站点。即使整个站点的其余部分都在 northamerica-northeast1
区域中,只有这个服务器功能已移至默认区域。
我认为这是在 google 云上重写的错误?还是我遗漏了什么或者某处的某个文档说该地区无法重写?
如果您想同时使用托管和云函数,函数位于 us-central1
。
Firebase Hosting supports Cloud Functions in us-central1 only.
Serve dynamic content and host microservices with Cloud Functions
我已经将 next.js 应用程序部署到 Google 云端,并且正在使用 Functions 和 Hosting。
我最近尝试将所有内容移动到 northamerica-northeast1
区域。我重新部署了所有函数,将 .region("northamerica-northeast1")
放在我所有函数的开头,如图 here 所示。这成功更新了我所有函数的位置。
不过,我还使用一个函数来为我的 next.js 应用程序提供服务:
const server = functions.https
.onRequest((request, response) => {
return app.prepare().then(() => handle(request, response));
});
然后我重写了这个函数的所有 URL:
"hosting": {
"target": "webapp",
"public": "public",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"function": "nextjs-server"
}
]
},
这都是 Google 云上的标准 next.js,我已经做了 2 年多了。但是,当我使用以下方法将函数移动到新区域时:
const server = functions
.region("northamerica-northeast1")
.https
.onRequest((request, response) => {
return app.prepare().then(() => handle(request, response));
});
重写似乎不再有效。该功能已更新,但当我访问该站点时,我收到 404。然后,当我将该功能移回默认区域(通过删除 .region())时,它再次正常工作。
我尝试了 3 个当前项目,同样的事情。
最后,我尝试创建一个全新的项目并部署到 northamerica-northeast
区域(和以前一样)并使用其中的区域代码推送功能......所以我的项目从来没有托管在 northamerica-northeast1
以外的任何地方,但仍然失败。但是,通过删除该区域,重写再次开始正常工作,我可以看到该站点。即使整个站点的其余部分都在 northamerica-northeast1
区域中,只有这个服务器功能已移至默认区域。
我认为这是在 google 云上重写的错误?还是我遗漏了什么或者某处的某个文档说该地区无法重写?
如果您想同时使用托管和云函数,函数位于 us-central1
。
Firebase Hosting supports Cloud Functions in us-central1 only.
Serve dynamic content and host microservices with Cloud Functions