What im doing wrong with my JS code? 😭

    const fpPromise = import('https://fpjscdn.net/v3/My api key')
    .then(FingerprintJS => FingerprintJS.load({ region: "us" }));

  // Get the visitor identifier when you need it.
  fpPromise
    .then(fp => fp.get())
    .then(result => {
      console.log(result.visitorId, result.requestId);
      bubble_fn_keepID(result.requestId);
    });

(Then the bubble_fn_keepID appears to have no value)

This seems to be code for an API call. Have you tested this in postman or with the API connector?

yes, the API call works perfectly, it is only a problem with the javascripttobubble.

The element doesn’t store any value, and I don’t know why.

Are you able to verify that the bubble_fn_keepID event is definitely triggering? That would be step 1 in debugging. If it’s definitely triggering an event, and it’s not publishing a value, did you make sure to set an output type on the JavascriptToBubble element?

This is needed for Bubble to know what kind of data to expect from the function.

Ensure that both Publish Value and Trigger Event settings of the JavascriptToBubble element are checked. Also check the function’s suffix value has no additional spaces (in the element settings).

If they are, then what you can do is in your code, store result.requestId in a new variable before passing it to bubble_fn_keepID.

This topic was automatically closed after 70 days. New replies are no longer allowed.