Figma Connect Failing
Please provide:
-
Code Connect CLI version [use
npx figma -Vif using React, orfigma -Votherwise, to get the version of your CLI] 1.2.2 -
Operating system Sonoma 14.7.1
-
Code Connect file, Figma design and/or relevant code snippet that could help us get more context
This is the error I'm getting when running swift run -c release --verbose figma-swift
/Users/kahlil/Desktop/swift-design-system/.build/checkouts/code-connect/swiftui/lib/CodeConnectTemplateWriter.swift:227:101: error: binary operator '??' cannot be applied to operands of type '(output: String, changes: [Formatter.Change])?' and 'String'
let formatted = (try? SwiftFormat.format(code.trimmedDescriptionRemovingReturnStatement())) ?? code.trimmedDescriptionRemovingReturnStatement()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kahlil/Desktop/swift-design-system/.build/checkouts/code-connect/swiftui/lib/CodeConnectTemplateWriter.swift:249:35: error: cannot infer contextual base in reference to member 'whitespacesAndNewlines'
).trimmingCharacters(in: .whitespacesAndNewlines)
I'm doing this because figma connect create returns this
node:events:495
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
Node.js v18.18.0
Hey @kahlillalji-ah! Thanks for the detailed report. Would you mind running npx figma connect create --verbose and sharing the output?
I'm not able to repro this error in a swift project on my end, so if the above doesn't surface anything it might be best for you to raise a support ticket so we can investigate in your file further.
@slees-figma I also encountered the same compile error, and I think it should be modified as follows🙏🏻 cc. @kahlillalji-ah
in CodeConnectTemplateWriter.swift 227L
- as-is:
let formatted = (try? SwiftFormat.format(code.trimmedDescriptionRemovingReturnStatement())) ?? code.trimmedDescriptionRemovingReturnStatement() - to-be:
let formatted = (try? SwiftFormat.format(code.trimmedDescriptionRemovingReturnStatement()).output) ?? code.trimmedDescriptionRemovingReturnStatement()