无法在测试步骤中找到有关从我的网站到 zapier 应用的可接受响应的信息(在我的网站上是 "Action")

Cant find information about acceptable response from my site to zapier app on test step (It's "Action" on my site )

我无法在测试步骤中找到有关从我的站点到 zapier 应用的可接受的响应内容或代码状态的信息。

我在 Laravel 上有我的网站和该网站的 Zapier 应用程序。在我的 Zapier 应用程序中,我有一个操作:"Create New Project"。我根据 the example 制作了我的 "create"。除测试步骤外,一切正常。我使用以下 zap 进行了测试:

奇怪的是,项目创建成功。因此,我认为问题出在我的站点对 zapier 的响应上:

// creates/project.js

// My perform function:
perform: (z, bundle) => {
  const promise = z.request({
    url: `${process.env.BASE_URL}/api/folder`,
    method: 'POST',
    body: JSON.stringify({
      title: bundle.inputData.title,
    }),
    headers: {
      'content-type': 'application/json',
    }
  });

  return promise.then((response) => JSON.parse(response.content));
}
//ZapierController.php

public function addFolder(Request $request)
{
    // Made record to DB, and other, after this returned same data which in request

    return response()->json(['title' => $request['title']]);
}

预期结果 - "Test this step" 测试成功。谁能帮帮我?

来自 Zapier 平台团队的大卫。

我已经回复了你的支持请求,但我想我会在这里回复以防其他人遇到同样的问题。

当你在 cli 上 运行 zapier logs 时,根本问题就很清楚了:

== Log
Unhandled error: CheckError: Invalid API Response:
  - Got a non-object result, expected an object from create ("title")
What happened:
  Executing creates.сFolder.operation.perform with bundle
  Invalid API Response:
  - Got a non-object result, expected an object from create ("title")

您的服务器可以回复任何 2xx 状态代码,但输出需要有效 json。 {"title": "my title here"} 之类的东西肯定会起作用。用户发现获取有关他们刚刚创建的项目的信息更有帮助,因此名称、id 等会更好。

至于为什么这表现为字符编码问题,我不知道。不过,我们计划查个水落石出!