zapier-platform-core 11.3.2 → 11.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/tools/create-logger.js +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zapier-platform-core",
|
|
3
|
-
"version": "11.3.
|
|
3
|
+
"version": "11.3.3",
|
|
4
4
|
"description": "The core SDK for CLI apps in the Zapier Developer Platform.",
|
|
5
5
|
"repository": "zapier/zapier-platform",
|
|
6
6
|
"homepage": "https://platform.zapier.com/",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"node-fetch": "2.6.7",
|
|
51
51
|
"oauth-sign": "0.9.0",
|
|
52
52
|
"semver": "7.3.5",
|
|
53
|
-
"zapier-platform-schema": "11.3.
|
|
53
|
+
"zapier-platform-schema": "11.3.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"adm-zip": "0.5.5",
|
|
@@ -167,6 +167,7 @@ class LogStream extends Transform {
|
|
|
167
167
|
class LogStreamFactory {
|
|
168
168
|
constructor() {
|
|
169
169
|
this._logStream = null;
|
|
170
|
+
this.ended = false;
|
|
170
171
|
}
|
|
171
172
|
|
|
172
173
|
getOrCreate(url, token) {
|
|
@@ -185,6 +186,10 @@ class LogStreamFactory {
|
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
async end() {
|
|
189
|
+
// Mark the factory as ended. This suggests that any logStream.write() that
|
|
190
|
+
// follows should end() right away.
|
|
191
|
+
this.ended = true;
|
|
192
|
+
|
|
188
193
|
if (this._logStream) {
|
|
189
194
|
this._logStream.end();
|
|
190
195
|
const response = await this._logStream.request;
|
|
@@ -240,6 +245,14 @@ const sendLog = async (logStreamFactory, options, event, message, data) => {
|
|
|
240
245
|
// no line breaks, and after an object it ends with a line break.
|
|
241
246
|
JSON.stringify({ message: safeMessage, data: safeData }) + '\n'
|
|
242
247
|
);
|
|
248
|
+
|
|
249
|
+
if (logStreamFactory.ended) {
|
|
250
|
+
// Lambda handler calls logger.end() at the end. But what if there's a
|
|
251
|
+
// (bad) callback that is still running after the Lambda handler returns?
|
|
252
|
+
// We need to make sure the bad callback ends the logger as well.
|
|
253
|
+
// Otherwise, it will hang!
|
|
254
|
+
logStreamFactory.end();
|
|
255
|
+
}
|
|
243
256
|
}
|
|
244
257
|
};
|
|
245
258
|
|