Retrieve fails when the project source is on a different drive than the OS temporary dir

Issue #710 resolved
Francois Poirier created an issue

I created a new custom object in my SF org. I then tried in IntelliJ - IlluminatedCloud to create a new trigger for that newly created object but could not find it.

Here are the steps I did so far without any luck

  • from the illuminated cloud I did a Refresh meta

  • from same menu I selected Retrieve metadata

  • Clicked the pencil next to Content

  • Clicked the refresh icon next to Selected

  • Checked the box next to my newly created object under the custom object section

*Clicked OK

*Select Retrieval scope widows says Nothing to show. Local + server and Server Only are the only box checked (local only and subscribed only are not checked)

  • Clicked the refresh icon in that screen, didn't change anything.

  • hit retrieve, nothing happens.

I tried adding the new trigger directly in SF. I was able to do so without any issues.

Since I already have a subscription to triggers I thought it would works seamlessly like it used to. * Refreshed metadata again from illuminatedCloud menu * Right clicked illuminatedCloud->retrieve Metadata from Triggers menu * I do see my new trigger in red indicating it is only on the server and there is a check mark next to it. * I click Retrieve and the only 2 components that are retrieved are my old trigger I created previously from illuminatedCloud. The one created on the server is not shown.

I've rebooted twice, restardted IntelliJ Idea about a hundred time. It's been 3 hours since I started working and can't get anything done.

Comments (20)

  1. Scott Wells repo owner

    Sorry for the issues, Francois. Let's see if we can figure out what's going on. First, let's enable some additional debug logging so we can see what's happening clearly. Under Help>Debug Log Settings please add:

    #com.illuminatedcloud.intellij.builder.ForceComMetadataRetriever
    

    That will log extensive information about what's being requested, what's being returned, etc.

    Just to clarify, Refresh Metadata won't bring down any new metadata that's not already present in the local filesystem. It's intended to be a quick way to get the latest copy of the server's version of whatever you have locally. It doesn't have to enumerate metadata in the server via potentially expensive API calls, and it doesn't bring up any intermediate dialogs for metadata selection or merging. To bring down new metadata you'll have to use Retrieve Metadata.

    To create a new trigger in IC, you can right-click on the triggers folder or, if that's not present because you've never created a trigger, on the src folder. If that's not working for you we'll need to get a log of whatever is going on there as well.

    To pull down a trigger that was created in the org, do the following (if you're using a Selected metadata subscription):

    1. Start a Retrieve Metadata action.
    2. In the resulting dialog, click the pencil icon beside Contents to open the subscription editor.
    3. Click the refresh button on the Selected toolbar.
    4. Once the refresh completes, scroll to the ApexTrigger metadata type and select the trigger(s) from the server.
    5. Click OK to close the subscription editor and the retrieve dialog should refresh automatically.
    6. If the selection for Contents includes triggers, you can just click either Retrieve or Retrieve for Merge depending on whether or not you need to review the retrieved metadata before it lands in your local source root.

    If those steps aren't working for you (and it sounds like they may not), please send me the resulting idea.log (Help>Show Log in Explorer) and hopefully it'll show what's happening clearly.

  2. Francois Poirier reporter

    Could you at least read my issue because from the look of that reply you clearly did not!

    I know how it should works but it is NOT working using the normal method.

  3. Scott Wells repo owner

    Francois, I did read your issue thoroughly before replying and know that there's a significant repetition relative to what you wrote. I wanted to detail very precise ordered steps primarily to produce a debug log that might show me what's going on. I'm very happy to help, but a debug log is my best method of diagnosing this from outside the system in which it's happening. Let's set the log levels and walk through those steps, then please email me the log and I'll take a look at what's happening.

  4. Francois Poirier reporter

    I created a new trigger on the same custom object in SF since I can't create triggers on that object in IC. The trigger is named testTriggerForScott

    I followed exactly your steps to retrieve it from the server.

    Did not retrieve this trigger even if it was showing in the selection before I hit retrieve.

    Here's the log.

  5. Scott Wells repo owner

    Thanks. And just to clarify on the first point, when you say you can't create a trigger on that object in IC, do you mean that it's a legitimate custom object but isn't showing up in the drop-down of SObjects? If so, is there anything special about that object relative to the others? Does an entry exist for it in the offline symbol table?

    Also, I apologize but I'm not seeing a log attached here or in my email inbox.

  6. Francois Poirier reporter

    I attached it to my email reply but it looks like it got removed in bitbucket.

    This object is not different in any way to the others. In fact I don't see any custom objects created since Yesterday in that drop-down.

    It does have an entry in the offline symbol table.

  7. Scott Wells repo owner

    Okay. Let me tackle one issue at a time. I'll review the log and let you know what I see, then I'll work with you on why it's not showing up in the drop-down. That drop-down should be based on all OST entries that extend SObject.

    One more thing to try while I'm reviewing the log...would you do a full rebuild of caches and indices using File>Invalidate Caches / Restart followed by Invalidate and Restart? I just want to make sure that bad caches aren't at the root of all this.

    I'll let you know what I see in the logs shortly.

  8. Scott Wells repo owner

    Okay, thanks for doing that. Bummer that it didn't help... More info to come shortly after I pore over the provided log.

  9. Scott Wells repo owner

    AHA! I already see what's happening. This is something I just helped another user debug, and it's freaking insidious! Right now IC doesn't support project data being on a different drive than the Windows temp directory, and that's exactly what's happening here:

    2017-09-20 11:41:39,333 [3672377]  DEBUG - lder.ForceComMetadataRetriever - Populating files for module = oldRetail Demo, extractDir = C:\Users\FRANOI~1\AppData\Local\Temp\oldRetail_Demo_4a0346cd_fd4a_4e2c_b314_2f7554d42be4, postRetrieveAction = POPULATE, onFinish = null 
    2017-09-20 11:41:39,333 [3672377]  DEBUG - lder.ForceComMetadataRetriever - extractDir = C:\Users\FRANOI~1\AppData\Local\Temp\oldRetail_Demo_4a0346cd_fd4a_4e2c_b314_2f7554d42be4 
    2017-09-20 11:41:39,333 [3672377]  DEBUG - lder.ForceComMetadataRetriever - contentRoot = D:/repository_sublime/oldRetail Demo 
    

    The problem stems from the fact that IC tries to move files from the temp directory used to hold the retrieved metadata into the local source directory, and you can't do a move across drives. I've been planning to fix this, but until I do there's a pretty easy workaround. Just set Windows' TMP and TEMP environment variables to a folder on the same drive as the source files. Please let me know if that doesn't get it working for you for now, and I'll use this ticket to prioritize the actual fix that allows it to work properly when the temp folder drive and the source folder drive are different.

  10. Scott Wells repo owner

    Regarding the new trigger dialog drop-down not including those SObjects, it just consults an index of SObject type names that's maintained as you work. If you haven't already, can you check that action one more time since rebuilding caches & indices to see whether it's still happening? If it is, can you verify that these SObjects' stub classes in the OST do in fact show as global class YourSObjectTypeName extends SObject?

  11. Francois Poirier reporter

    I changed the temp dir and it did fix the retrieve issue.

    I don't know if it's the cache and indices rebuilding or the new temp directory but I am now able to create new triggers on newly created object in IC

    Thanks!

  12. Scott Wells repo owner

    Okay, glad to hear on all counts! Sorry for the issues and thanks for working through them with me. Keep an eye on this issue to know when I've addressed the problem with multiple drives.

  13. Scott Wells repo owner

    Issue tracker grooming. If this is still an issue, please feel free to reopen, ideally with a concrete reproduction scenario.

  14. Log in to comment