小编Dom*_*rga的帖子

在多区域存储桶中部署云存储触发器

我正在尝试按照此处的指南部署云存储触发器: https: //cloud.google.com/functions/docs/tutorials/storage#object_finalize

我想监听我的默认“美国多区域”存储桶中的任何最终确定。不幸的是,当我尝试通过 gcloud cli 部署函数触发器时,如上面的链接所述:

gcloud functions deploy **** \
--gen2 \
--region=us-central1 \
--project=**** \
--trigger-event-filters="type=google.cloud.storage.object.v1.finalized" \
--trigger-event-filters="bucket={my-multi-region-bucket}"
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

INVALID_ARGUMENT: Cannot create trigger ****: 
Bucket '****' is in location 'us', but the trigger location is 'us-central1'.
The trigger must be in the same location as the bucket. 
Try redeploying and changing the trigger location to 'us'.
Run Code Online (Sandbox Code Playgroud)

google-cloud-storage google-cloud-platform gcloud google-cloud-functions

4
推荐指数
1
解决办法
720
查看次数

Stream Listen() 方法 onDone 回调未被调用

我无法触发流的 onDone 回调。

我尝试取消流订阅并关闭流控制器,但它不起作用。

这是一个基本示例:

示例代码:

import 'dart:async';

void main() async {
  final streamController = StreamController<int>();

  final streamSubscription = streamController.stream.listen(
    (event) => print('Value emitted: $event'),
    onDone: () => print('Task done'),
  );

  streamController.add(1);

  await Future<void>.delayed(Duration.zero);
  await streamSubscription.cancel();
  await streamController.close();
}
Run Code Online (Sandbox Code Playgroud)

预期输出:

Value emitted: 1
Task done
Run Code Online (Sandbox Code Playgroud)

实际输出:

Value emitted: 1
Run Code Online (Sandbox Code Playgroud)

dart flutter

3
推荐指数
1
解决办法
3779
查看次数