我正在使用Firebase托管设置重定向(重写),以便可以调用从google cloud运行在此处运行的api 。
我尝试过更改重写字符串"/api/**"(应将所有内容捕获到page.com/api/**并将其发送给函数)。删除了index.html并交换为"**"捕获所有路径,包括索引。到目前为止没有任何工作。
我的托管firebase.json是这样设置的,这有什么问题吗?
{
"hosting": {
"public": "dist/public",
"ignore": ["firebase.json", "**.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"run": {
"serviceId": "next-js-base-api",
"region": "us-central1"
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
我还尝试了正常重定向到另一个页面,这不起作用,是什么决定了firebase.json设置何时开始传播和起作用?
我尝试运行托管模拟器,并进行了修改后的重写"source": "/api/**",结果如下。导航到/ api返回非崩溃(不重定向),浏览器中的输出cannot GET /api导航到api / wkapi(由api端点捕获的子目录)unexpected error在浏览器中返回,
Error: Unable to find a matching rewriter for {"source":"/api/**","run":{"serviceId":"next-js-base-api","region":"us-central1"}}
Run Code Online (Sandbox Code Playgroud)
在控制台中。
我正在尝试在新的github action yaml格式(新)中重建ci-cd,问题是我似乎无法在一个步骤中将计算值用作参数。
我尝试了以下
- name: Download Cache
uses: ./.github/actions/cache
with:
entrypoint: restore_cache
args: --bucket=gs://[bucket secret] --key=node-modules-cache-$(checksum package.json)-node-12.7.0
Run Code Online (Sandbox Code Playgroud)
但是,“ $(checksum package.json)”作为参数的一部分无效。请不要与命令校验和存在(容器中确实存在)无关。
我正在尝试在Google Cloud build中复制这种设置
- name: gcr.io/$PROJECT_ID/restore_cache
id: restore_cache_node
args:
- '--bucket=gs://${_CACHE_BUCKET}'
- '--key=node-modules-cache-$(checksum package.json)-node-${_NODE_VERSION}'
Run Code Online (Sandbox Code Playgroud)
我希望能够以与其他ci-cd解决方案类似的方式使用计算参数。
有没有办法做到这一点,我很想念?也许能够在docker容器中使用'run:'来运行一些命令。