我正在尝试将缓存(从表单上传的文件)保存到Google云端存储,但似乎Google Node SDK只允许上传具有给定路径的文件(读/写流).
这是我用于AWS(S3)的东西 - Google节点SDK中的其他类似内容吗?:
var fileContents = new Buffer('buffer');
var params = {
Bucket: //bucket name
Key: //file name
ContentType: // Set mimetype
Body: fileContents
};
s3.putObject(params, function(err, data) {
// Do something
});
Run Code Online (Sandbox Code Playgroud)
我到目前为止找到的唯一方法是将缓冲区写入磁盘,使用SDK上传文件(指定新文件的路径),然后在文件成功上传后删除该文件 - 这样做的缺点是整个过程明显变慢,使用谷歌存储似乎是不可行的.是否有任何工作/方式上传缓冲区?
我运行时在appengine上出现此错误gcloud preview app run app.yaml
:
The --custom_entrypoint flag must be set for custom runtimes
我app.yaml
看起来像:
version: 0-1-1
runtime: custom
vm: true
api_version: 1
manual_scaling:
instances: 1
handlers:
- url: .*
script: dynamic
Run Code Online (Sandbox Code Playgroud)
我的dockerfile只是:
FROM google/nodejs-runtime
我重新安装gcloud
以获取最新版本,在托管虚拟机的yaml配置中做了哪些更改?这使我无法测试我的应用程序.
我已按照教程https://cloud.google.com/nodejs/getting-started/hello-world(在node.js上部署到Google Cloud Platform hello world应用程序)并在最后一个命令之后:
$ gcloud预览应用程序部署app.yaml --promote
我明白了:
将文件复制到Google云端存储...将文件同步到[gs://staging.first-server-1117.appspot.com/].更新模块[默认] ...失败.错误:(gcloud.preview.app.deploy)错误响应:[13]托管虚拟机无法托管在应用程序的区域中.(e~)版本:20151103t135918.388305842753805715
即使使用未选择的时区也会发生这种情况.
为什么会这样?或者它是如何修复的?
谢谢.
我已经制作了一个Dockerfile用于将我的node.js应用程序部署到谷歌容器引擎中.它看起来如下所示
FROM node:0.12
COPY google-cloud-sdk /google-cloud-sdk
RUN /google-cloud-sdk/bin/gcloud init
COPY bpe /bpe
CMD cd /bpe;npm start
Run Code Online (Sandbox Code Playgroud)
我应该在Dockerfile中使用gcloud init,因为我的node.js应用程序正在使用gcloud-node模块在GCS中创建存储桶.当我使用上面的dockerfile并建立docker时,它失败并出现以下错误
sudo docker build -t gcr.io/[PROJECT_ID]/test-node:v1 .
Sending build context to Docker daemon 489.3 MB
Sending build context to Docker daemon
Step 0 : FROM node:0.12
---> 57ef47f6c658
Step 1 : COPY google-cloud-sdk /google-cloud-sdk
---> f102b82812f5
Removing intermediate container 4433b0f3627f
Step 2 : RUN /google-cloud-sdk/bin/gcloud init
---> Running in 21aead97cf65
Welcome! This command will take you through the configuration of gcloud.
Your current …
Run Code Online (Sandbox Code Playgroud) docker gcloud gcloud-node google-kubernetes-engine dockerfile
我正在尝试使用 gcloud api 在谷歌云存储中重命名或移动文件夹。
一个类似的问题解释了如何删除文件夹: Delete folder in Google Cloud Storage using nodejs gcloud api
但是如何重命名文件夹?或移动到另一条路?
node.js google-api-nodejs-client gcloud-node firebase-storage
有没有什么办法让从当前实例ID 的应用程序引擎中的node.js?
我发现只有java和python的解决方案,但没有找到节点的解决方案.
如何创建与父母使用的实体gcloud
,datastore
以及nodejs
?
如何搜索给定父级的所有实体?
像(这不起作用):
var path = [{kind: 'Parent', id: parentId}, {kind: 'Me'}];
var key = ds.key(path);
var entity = {
key: key,
data: toDatastore(data, ['description'])
};
ds.save(entity)
Run Code Online (Sandbox Code Playgroud)
阅读文档我没有找到任何创建具有给定父级的实体的示例.我在这里搜索(没有成功):https: //googlecloudplatform.github.io/gcloud-node/#/docs/v0.19.1
而在python中的对应物上有一些特定的属性来指定父实体:http: //googlecloudplatform.github.io/gcloud-python/latest/datastore-keys.html
请提供有关如何使用父级创建和搜索实体的代码示例
我需要从谷歌云存储中删除多个对象.我一次删除了一个对象.
这是我的代码:
var gcloud = require('gcloud')({
projectId: "sampleProject1"
});
var gcs = gcloud.storage();
var myBucket = gcs.bucket('sampleBucket1');
var file = myBucket.file('1.png');
file.delete(function (err, apiResponse) {
if (err) {
console.log(err);
}
else {
console.log("Deleted successfully");
}
});
Run Code Online (Sandbox Code Playgroud)
但我需要同时删除多个对象.有可能吗?
我们有一个庞大的小节点应用程序,想试用谷歌云部署套件使其在线,但是我们的部署总是导致页面出现 500 服务器错误。
通常我会提供更多信息、错误等,但我希望有更多知识的人可以指导我在哪里可以找到这些信息。值得注意的是没有出现在gcloud终端时,我们gcloud preview app deploy
,只是一个帮preparing
和pushing
和最终的deployed module [default] to ...
消息。但是,导航到 URL 会给我们一个 500 服务器错误:
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
Run Code Online (Sandbox Code Playgroud)
看一眼响应头并没有提供更多信息,所以我浏览了堆栈驱动程序/日志,但唯一的一件事是一堆/_ah/background
GET,没有任何我们请求的迹象。
我们可以从哪里开始调试这个问题?它是一个节点应用程序,具有节点/快速后端、反应前端和 webpack 构建器。
编辑:这是应用引擎仪表板的屏幕截图。
我们的app.yaml
:
runtime: nodejs
vm: true
skip_files:
- ^(.*/)?.*/node_modules/.*$
Run Code Online (Sandbox Code Playgroud)
我们的package.json
:
"scripts": {
"test": "karma start",
"watch": "watch 'npm run test' client/",
"clean": "rm -rf dist", …
Run Code Online (Sandbox Code Playgroud) google-app-engine node.js google-compute-engine gcloud gcloud-node
我正在使用gcloud-node。
如果该主题已存在,createTopic api 将返回错误 409。是否有一个标志可以在发布消息时隐式创建主题,或者是否有 API 来检查主题是否已存在?
它易于使用 getTopics API,迭代响应主题数组并确定主题是否存在。只是想确保我不会写一些东西,如果它已经存在的话。
gcloud-node ×10
node.js ×7
gcloud ×5
deploying ×1
docker ×1
dockerfile ×1
javascript ×1
managed-vm ×1
npm ×1