"undefined" is not valid JSON ( "--fetch" flag)

Hi,

I’m looking for assistance with my Coda Pack code. I encountered an error stating that “undefined” is not valid JSON. You can find my pack at this link: https://coda.io/p/23988?section=code

During my research, I came across a post mentioning the reason for the error. It seems that by default, Coda execute doesn’t fetch real data and returns an undefined response object. To enable fetching real data, the “–fetch” flag needs to be included. The post also mentions that this behavior will be changed in the next release of the SDK, where “–fetch” will become the default, but this release is not yet available.

I’m unsure how to run the code on the Coda Pack interface, especially with regard to using the “–fetch” flag. Can anyone help me with this issue? Thanks in advance!

Cheers,

This is an invalid address.

This simply means that you are trying to parse or handle (as JSON) a variable that is undefined.

Updated code

import * as coda from "@codahq/packs-sdk";

const pack = coda.newPack();
// Updated: export const pack = coda.newPack();

pack.addNetworkDomain("api-adresse.data.gouv.fr");

pack.addFormula({

Thanks for your message.
I’ve added the code below my 1st post.

I think this issue is here -

CleanShot 2023-07-22 at 16.14.15@2x

1 Like

Well yes Bill_French! Thanks, that was it!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.