Reputation: 1
I am encountering several errors while running my Figma plugin, which converts websites into editable Figma designs. The plugin fetches website content, processes HTML and CSS, and transforms it into Figma components while preserving styles, layout, and assets. However, I am facing manifest permission issues and syntax errors, which are preventing the plugin from functioning correctly.
Project URL: GitHub repository
Error details
1️⃣ Manifest Errors
Invalid permission specified: currentPage
Invalid value for networkAccess. If you want to allow all domains, please add a "reasoning" field to the networkAccess object.
2️⃣ Syntax Error in Vendor Core File
pgsql
Copy
Edit
Syntax error on line 52: Unexpected token .
parsed.textContent = element.textContent?.trim();
^
Possible cause: The ?. optional chaining operator might be unsupported in the Figma plugin environment.
3️⃣ Multiplayer Session Connection Issues
The console logs repeated messages:
csharp
Copy
Edit
[MultiplayerSession] connecting to wss://www.figma.com/api/multiplayer/...
This is followed by multiple reconnection attempts.
📌 Workflow & Where the Error Occurs
🔄 Backend Process Flow
1️⃣ Initial Request Processing
figma.ui.onmessage listens for a message when the user requests a website conversion.
The plugin fetches the website’s content using fetch(msg.url).
2️⃣ HTML Parsing (src/parsers/htmlParser.ts)
Converts the raw HTML into a structured DOM tree.
Extracts properties, styles, and attributes.
Handles special elements (images, SVGs).
3️⃣ CSS Processing (src/parsers/cssParser.ts)
Extracts CSS rules and computes styles.
Resolves shorthand properties and media queries.
4️⃣ Style Conversion (src/utils/styleConverter.ts)
Converts CSS properties to Figma-compatible formats.
Handles unit conversions (px, rem, em).
5️⃣ Figma Node Creation (src/utils/figmaUtils.ts)
Creates corresponding Figma nodes.
Applies styles, layout, and constraints.
🛠️ Where the Errors Occur
Manifest errors: Occur when Figma attempts to validate permissions.
Syntax error: Happens in a minified vendor core file, likely due to unsupported optional chaining (?.).
Multiplayer Session WebSocket reconnect loop: Indicates a WebSocket connectivity issue with Figma’s API.
🛠️ Steps Taken to Resolve
✔️ Verified manifest.json to ensure correct permissions for currentPage and networkAccess.
✔️ Checked if optional chaining (?.) is causing compatibility issues with the Figma plugin environment.
✔️ Attempted manual reconnection, but WebSocket disconnections persist.
How can I fix these issues?
Upvotes: -3
Views: 24