错误:HTTP错误:400,必须提供具有重写配置[Firebase]的非空glob/regex模式
我刚开始学习并完成了关于的教程。当我继续执行错误:HTTP错误:400,必须提供具有重写配置[Firebase]的非空glob/regex模式,firebase,firebase-hosting,Firebase,Firebase Hosting,我刚开始学习并完成了关于的教程。当我继续执行firebase部署时,出现以下错误消息: > tsc ✔ functions: Finished running predeploy script. i database: checking rules syntax... ✔ database: rules syntax for database salesman-firebase001 is valid i firebase.storage: checking storage.ru
firebase部署
时,出现以下错误消息:
> tsc
✔ functions: Finished running predeploy script.
i database: checking rules syntax...
✔ database: rules syntax for database salesman-firebase001 is valid
i firebase.storage: checking storage.rules for compilation errors...
✔ firebase.storage: rules file storage.rules compiled successfully
i firestore: reading indexes from firestore.indexes.json...
i cloud.firestore: checking firestore.rules for compilation errors...
✔ cloud.firestore: rules file firestore.rules compiled successfully
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
✔ functions: required API cloudfunctions.googleapis.com is enabled
Error: HTTP Error: 400, Must supply a non-empty glob/regex pattern with rewrite configuration
我已经去了,在我的firebase.json
中添加了必要的组件。托管的更新代码
:
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
// Serves index.html for requests to files or directories that do not exist
"source": "**",
"destination": "/index.html"
}, {
// Serves index.html for requests to both "/foo" and "/foo/**"
// Using "/foo/**" only matches paths like "/foo/xyz", but not "/foo"
"source": "/foo{,/**}",
"destination": "/index.html"
}, {
// A regular expression-based rewrite equivalent to the above behavior
"regex": "/foo(/.*)?",
"destination": "/index.html"
}, {
// Excludes specified pathways from rewrites
"source": "!/@(js|css)/**",
"destination": "/index.html"
} ]
},
谢谢您的时间。尝试一下排除过程。删除所有重写,然后分别添加每一个,直到找出问题的根源。@DougStevenson我已经删除了正则表达式,它正在运行,但仍然不知道它为什么返回HTTP错误:400。无论如何,谢谢你的建议!即使使用最简单的正则表达式,我们也会遇到同样的错误。不知道出了什么问题。@DougStevenson我认为为firebase.json中的任何字段提供正则表达式现在都是错误的。我在“headers”而不是“rewrites”中遇到了同样的问题,并偶然发现了这个问题的答案,其配置仅包含“source”(globs)。想要引起firebase团队注意的是,如果您有错误报告,请直接联系firebase支持。尝试一个消除的过程。删除所有重写,然后分别添加每一个,直到找出问题的根源。@DougStevenson我已经删除了正则表达式,它正在运行,但仍然不知道它为什么返回HTTP错误:400。无论如何,谢谢你的建议!即使使用最简单的正则表达式,我们也会遇到同样的错误。不知道出了什么问题。@DougStevenson我认为为firebase.json中的任何字段提供正则表达式现在都是错误的。我在“headers”而不是“rewrites”中遇到了同样的问题,并偶然发现了这个问题的答案,其配置仅包含“source”(globs)。想要引起firebase团队注意的是,如果您有错误报告,请直接联系firebase支持。