Can’t set hyperlink to instance node through plugin API

On Figma UI, it’s easy to set a hyperlink to an instance node by right click “Copy/Paste as“ > “Copy link“. However, I got an error when doing the same thing through plugin API.

The document only says “the (target) node cannot be a sublayer of an instance”. But how about target to that exact instance?

I’m wondering why they are inconsistent. Is there any concern behind?

6 Likes

Does anyone know the answer or the mechanics behind? :neutral_face: Or any Figma employee has been looking into this?

3 Likes

Is there any solution or workaround?
I’ve tried to copy a text with links inside from one TextNode to another.
Though getRangeHyperlink gives a range split, setRangeHyperlink throws exactly the same error “Invalid hyperlink node reference. Hyperlink target node must be a page or a frame” in case the source link type is “NODE”. In case link type is “URL” no error appears.

2 Likes

Update:
The error appears when target node is ‘InstanceNode’

1 Like

This also happens to us when the target node is a Main Component.

Basically the documentation only says “cannot be a sublayer of an instance”.
And the error says “it must be a page or a frame”.

Something’s off.

3 Likes

Upvote to fix this bug in the API.

3 Likes

Upvote to fix this bug, I really need this fix.
Same issue here Can't set hyperlink to page node with plugin

Upvote to fix this bug in the API.

This is also a problem for links to Sections. It is quickly becoming a major reason why I’m hesitant to switch my organizing structure in Figma from frames to sections.

1 Like

Please fix this bug!

Now this should be fixed. See the Plugin API changelog: