notero icon indicating copy to clipboard operation
notero copied to clipboard

TypeError: style.getCiteProc is not a function

Open Jutdm opened this issue 4 years ago • 26 comments

Hello,

Thanks for this add-on ! I installed i(, but when trying to add a new document, this error message comes in :

"Failed to save item(s) to Notion. TypeError: style.getCiteProc is not a function"

Do you have an idea of what the problem could be, and how to solve it ?

Thank you !

Jutdm avatar Nov 17 '21 14:11 Jutdm

Hi @Jutdm, thanks for reporting!

To help me track down the issue, could you open the Error Console in Zotero from Tools > Developer > Error Console and then try to save items into Notion again. Could you send me a screenshot of whatever messages you see there?

Also, what version of Zotero are you using?

dvanoni avatar Nov 17 '21 16:11 dvanoni

Thank you for your quick response !

I'm on Zotero 5.0.

Here is what is written :

image

Jutdm avatar Nov 17 '21 16:11 Jutdm

Hi @Jutdm, sorry for the delay getting back to you.

Can you let me know what format you have selected in Zotero's Export settings? (See screenshot below for what I'm referring to.) I believe the error you're running in to is related to the export format.

Also, can you let me know what other add-ons you're using (if any)?

Thanks!

CleanShot 2021-12-11 at 17 22 33@2x

dvanoni avatar Dec 12 '21 00:12 dvanoni

Hello @dvanoni,

Thank you for your response !

I use a French format, and no other add-on. Here is the name of the format :

image

EDIT : actually, when changing the exporting format to APA, the add-on works. But is there any way I could continue to use my current format ?

Thank you, Ju

Jutdm avatar Dec 12 '21 09:12 Jutdm

@Jutdm thanks for this additional info! It's sounds like we're on the right track. I downloaded the format you're using to try to reproduce the error on my side, but I haven't been able to so far.

Would you mind downloading the latest version of the style to see if that helps at all? I wonder if there have been any fixes to it since you previously installed it. It looks like it was last updated in February.

To additionally help with debugging, would you mind running a snippet of JavaScript in Zotero and sending me the output? You can open the window from Tools > Developer > Run JavaScript (or the French equivalent 😄). Here's the code I'd like you to run:

let format = Zotero.Prefs.get('export.quickCopy.setting');
format = Zotero.QuickCopy.unserializeSetting(format);
Zotero.Styles.get(format.id);

It should output something like this:

CleanShot 2021-12-12 at 10 05 55@2x

Thanks!

dvanoni avatar Dec 12 '21 17:12 dvanoni

Hello,

I downloaded this format a few weeks ago, so I guess it already was the latest version.

And here is the output : image

Thank you !

Jutdm avatar Dec 13 '21 09:12 Jutdm

Thanks @Jutdm! Unfortunately, I'm not seeing anything out of the ordinary in your screenshot. I was curious to see if getCiteProc was going to be returned as something unexpected, but as you can see, it appears to be a function just like in my screenshot...

I'm still digging in to this to see if I can figure out what's causing the issue. I'll keep you posted!

P.S. It looks like someone else has reported running in to the same error in the Zotero Forums.

dvanoni avatar Dec 15 '21 06:12 dvanoni

:robot: this is your friendly neighborhood build bot announcing test build 0.1.2.18 ("fix: Ensure errors are logged regardless of if they have a stack")

Install in Zotero by downloading test build 0.1.2.18, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".

github-actions[bot] avatar Dec 15 '21 06:12 github-actions[bot]

@Jutdm would you mind doing me a favor and installing the test build posted above? It won't fix the issue, but it should enable some more error logging that will hopefully be visible from Tools > Developer > Error Console.

After installing the test build, could you open the Error Console and then try syncing items again to cause the error to occur? Then send me a screenshot of the error?

Thank you!

dvanoni avatar Dec 15 '21 06:12 dvanoni

Hello !

I actually found a solution. I downloaded the "APA" format to show you the problem, and forgot to delete it after. I put the format "Presses Universitaires de Rennes" back as the default format, and the synchronization actually worked. If I delete APA, it doesn't, but I just have to keep it that way.

I guess this solution is good enough, but thank you very much for your implication in this process ahah !

I just have another little question. If it doesn't take too much time, could you do something for this little issue, please ?

When I add a new document, the title of the document is not added in the "Title" column. Instead, the quotation format of the name and date of the article is the title. For example : (Goldbeter-Merinfeld, 2021) is the title of the document below, and I would like it to be "Patrimoine, argent et conflits familiaux. Introduction" instead.

image

I would love to have it this way automatically : image

I tried renaming the column "Title", but it doesn't work. I need to create an additionnal column called "Title", which is not the actual title of the document in the database. I don't know if I make sense here ahah.

Thank you very much !

Jutdm avatar Dec 15 '21 13:12 Jutdm

Ah, I understand what's causing the issue now! Currently, the code assumes that the APA style is available and uses it to generate the name of the Notion page—the (author, year) text that you referred to. I hadn't considered that the APA style could be removed, so that was a bad assumption!

I think this issue is related to a couple others. Someone just mentioned in #14 that they'd also like to have the page name in Notion be the full article title, and others folks in #5 would like to use a different citation key as the page name. So, it sounds like the solution is to make this configurable and not assume that a specific style is installed.

@Jutdm thank you so much for debugging this with me, and I'm glad you were able to find a workaround!

dvanoni avatar Dec 15 '21 15:12 dvanoni

Thank you very much for your work, this pluggin is soooo helpful !

Jutdm avatar Dec 15 '21 16:12 Jutdm

I get the same error when connecting Zotero with Obsidian. I followed the above steps, but it keeps showing the same error.

image image

swwwwws avatar Feb 15 '23 17:02 swwwwws

@swwwwws, just to confirm, do you have the American Psychological Association 7th edition style installed in Zotero? If not, can you install it from https://www.zotero.org/styles/apa and let me know if you're still encountering the issue?

dvanoni avatar Feb 16 '23 06:02 dvanoni

@dvanoni thanks for the quick reply. Yes I installed APA style in Zotero. It was installed and to be sure I installed it again with the .csl file, before I posted yesterday.

image

swwwwws avatar Feb 16 '23 15:02 swwwwws

@swwwwws, I'm a bit stumped on this one. Would you mind sending me another screenshot of the Error Console? This time, could you open it and click the "Clear" button on the top right before triggering the error. Then once you've encountered the error, scroll to the bottom of the window (if necessary) to ensure you capture as much of the latest message as possible. Thanks!

dvanoni avatar Feb 17 '23 05:02 dvanoni

@dvanoni This is the whole error log in the two pictures below. I cleared the log beforehand and then immediately triggered the error.

image

image

swwwwws avatar Feb 17 '23 09:02 swwwwws

Thanks for the additional screenshots, @swwwwws. How are you triggering the error?

dvanoni avatar Feb 18 '23 02:02 dvanoni

In Obsidian I us Command-P and select Zotero Better BibTex integration. Then the Zotero hovering search bar appears and I select a publication. After a short t time, I get the error in Obsidian.

image

image

image

swwwwws avatar Feb 18 '23 10:02 swwwwws

I did some digging, but I'm unfamiliar with the specifics of Better BibTeX and Obsidian Zotero Integration. I'd suggest reaching out to the maintainers of those plugins to see if they can dig into this further.

I'm not sure if I'm on the right path, but I found a reference to a translator ID in the code of Obsidian Zotero Integration, and the location of that translator in Better BibTeX. You may be able to reference these when reaching out to those maintainers.

dvanoni avatar Feb 18 '23 19:02 dvanoni

Thank you for your time and effort! I will bring it to the people who maintain it

swwwwws avatar Feb 19 '23 13:02 swwwwws

@swwwwws I had the same issue and realized I forgot to create a citation format in the Zotero plugin settings on obsidian (I only had a import format). Once I had created a citation format and matched the citation style to the one I was using in my import formats everything worked fine. (see screenshots attached). Hope that helps !

image

image

(Sorry if this should be posted somewhere else, I did not see an issue on the Obisidian Zotero integration github about this subject):

dufourc1 avatar Mar 30 '23 08:03 dufourc1

Same as mentioned here by @Jutdm https://github.com/dvanoni/notero/issues/12#issuecomment-994776511, I downloaded the APA style again and it worked, even if I already had a apa.csl in my Zotero styles folder. Too bad I didn't copy it before updating to be able to compare both versions.

For me, the issue appeared through Obsidian Zotero Integration plugin. And contrary to what was mentioned here by @dufourc1 https://github.com/dvanoni/notero/issues/12#issuecomment-1489927978 I didn't have to create a citation format in Obsidian Zotero Integration plugin settings, updating apa.csl in Zotero styles folder solved it.

nicolnt avatar Feb 19 '24 13:02 nicolnt

Seems to be fixed in the next beta: https://forums.zotero.org/discussion/comment/456092#Comment_456092

nicolnt avatar Feb 21 '24 07:02 nicolnt

Thanks for sharing that thread, @nicolnt! I doubt the fix they mention will resolve the issue for Notero because Notero still relies on the APA style specifically, but I'm going to see if I can fix that by using a similar approach with a hard-coded format instead of APA.

dvanoni avatar Feb 22 '24 05:02 dvanoni

Well, I don't know that I'm going to hear back from the Zotero developers on that thread. (I know they're very busy.)

I did some digging, and I think the code to use as a reference lives here.

dvanoni avatar Mar 02 '24 18:03 dvanoni