Skip to content

Commit 71d7b46

Browse files
fix(singer-target): ignore state messages before checking schema
1 parent 6e84904 commit 71d7b46

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

backend/commands/singer-target.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,20 @@ exports.handler = async function singerTarget({
101101
const clearedSheets = new Set();
102102
const writtenStreams = new Set();
103103
for await (const { type, stream, ...message} of readMessages({ jsonlFile })) {
104-
const sheet = sheets[stream];
105-
106104
console.log(`${type}\t${stream}`, message);
107105

108106

107+
// ignore state for now
108+
if (type == 'STATE') {
109+
console.warn('ignoring STATE message');
110+
continue;
111+
}
112+
113+
114+
// get sheet
115+
const sheet = sheets[stream];
116+
117+
109118
// create schema if needed
110119
if (!sheet) {
111120
if (type == 'SCHEMA') {
@@ -129,13 +138,6 @@ exports.handler = async function singerTarget({
129138
}
130139

131140

132-
// ignore state for now
133-
if (type == 'STATE') {
134-
console.warn('ignoring STATE message');
135-
continue;
136-
}
137-
138-
139141
// handle record message
140142
if (type == 'RECORD') {
141143
if (deleteMissing && !clearedSheets.has(sheet)) {

0 commit comments

Comments
 (0)