trailheadapps / lwc-recipes

A collection of easy-to-digest code examples for Lightning Web Components on Salesforce Platform
https://developer.salesforce.com
Creative Commons Zero v1.0 Universal
2.59k stars 3.07k forks source link

platformWorkspaceApi EnclosingTabId Throws "n.connect is not a function" Errors #921

Closed BatemanVO closed 7 months ago

BatemanVO commented 7 months ago

Summary

Using the sample workspaceOpenSubtab component found in this repo, "n.connect is not a function" errors are thrown

Salesforce Org Type

Sandbox

Steps To Reproduce

Steps to Reproduce

I've created a repo with the code I am using at this link.

I've gone into my personal Sandbox and created a new custom object, EnclosingTab__c.

Current Behavior

"n.connect is not a function" error is thrown when attempting to use the EnclosingTabId method imported from lightning/platformWorkspaceApi

Expected Behavior

EnclosingTabId should provide the Id of the tab the component is loaded on

Relevant Log Output

TypeError: n.connect is not a function
    at Array.<anonymous> (https://static.lightning.force.com/usa770s.sfdc-8tgtt5/auraFW/javascript/MFZGMnNxcWxxQVZkaERsVUY3RzNmZ3ZrcWo2bHVYSXBmeGJiLUx2eVNiWWcyNDguMTAuMy01LjAuOQ/aura_prod.js:51:44171)
    at https://static.lightning.force.com/usa770s.sfdc-8tgtt5/auraFW/javascript/MFZGMnNxcWxxQVZkaERsVUY3RzNmZ3ZrcWo2bHVYSXBmeGJiLUx2eVNiWWcyNDguMTAuMy01LjAuOQ/aura_prod.js:51:45485
    at bo (https://static.lightning.force.com/usa770s.sfdc-8tgtt5/auraFW/javascript/MFZGMnNxcWxxQVZkaERsVUY3RzNmZ3ZrcWo2bHVYSXBmeGJiLUx2eVNiWWcyNDguMTAuMy01LjAuOQ/aura_prod.js:51:45488)
    at nr (https://static.lightning.force.com/usa770s.sfdc-8tgtt5/auraFW/javascript/MFZGMnNxcWxxQVZkaERsVUY3RzNmZ3ZrcWo2bHVYSXBmeGJiLUx2eVNiWWcyNDguMTAuMy01LjAuOQ/aura_prod.js:51:30482)
    at tr (https://static.lightning.force.com/usa770s.sfdc-8tgtt5/auraFW/javascript/MFZGMnNxcWxxQVZkaERsVUY3RzNmZ3ZrcWo2bHVYSXBmeGJiLUx2eVNiWWcyNDguMTAuMy01LjAuOQ/aura_prod.js:51:30043)
    at rr (https://static.lightning.force.com/usa770s.sfdc-8tgtt5/auraFW/javascript/MFZGMnNxcWxxQVZkaERsVUY3RzNmZ3ZrcWo2bHVYSXBmeGJiLUx2eVNiWWcyNDguMTAuMy01LjAuOQ/aura_prod.js:51:30607)
    at https://static.lightning.force.com/usa770s.sfdc-8tgtt5/auraFW/javascript/MFZGMnNxcWxxQVZkaERsVUY3RzNmZ3ZrcWo2bHVYSXBmeGJiLUx2eVNiWWcyNDguMTAuMy01LjAuOQ/aura_prod.js:51:29955
    at tr (https://static.lightning.force.com/usa770s.sfdc-8tgtt5/auraFW/javascript/MFZGMnNxcWxxQVZkaERsVUY3RzNmZ3ZrcWo2bHVYSXBmeGJiLUx2eVNiWWcyNDguMTAuMy01LjAuOQ/aura_prod.js:51:29979)
    at rr (https://static.lightning.force.com/usa770s.sfdc-8tgtt5/auraFW/javascript/MFZGMnNxcWxxQVZkaERsVUY3RzNmZ3ZrcWo2bHVYSXBmeGJiLUx2eVNiWWcyNDguMTAuMy01LjAuOQ/aura_prod.js:51:30607)
    at br (https://static.lightning.force.com/usa770s.sfdc-8tgtt5/auraFW/javascript/MFZGMnNxcWxxQVZkaERsVUY3RzNmZ3ZrcWo2bHVYSXBmeGJiLUx2eVNiWWcyNDguMTAuMy01LjAuOQ/aura_prod.js:51:35186)

Code of Conduct

github-actions[bot] commented 7 months ago

Thank you for posting this issue. 🙇🏼‍♂️
We will come back to you shortly.

BatemanVO commented 7 months ago

As noted in the documentation, issue is because Lightning Web Security needs to be enabled in the Org instead of Lightning Locker.