requestJira method in UIKit 2 version returns error

Hey guys,
I’m trying to rewrite my app to use new UIKit2 versions and for handling backend requests it is now moved to resolvers, so basically when I’m trying to use the method requestJira I’m getting this error in log , screnshot attached

Error: Error thrown in the snapshot context.
App code snapshot error: window is not defined
Learn more about the snapshot context at https://go.atlassian.com/forge-snapshot-context.

2 Likes

Hi @NarekMamikonyan

Thank you for trying out UI Kit 2!

The @forge/bridge package is only used in the front-end, so if you’re writing backend resolvers, the package to use would be @forge/api (https://developer.atlassian.com/platform/forge/runtime-reference/product-fetch-api/)

Let me know if that works for you =)

1 Like

Hi , thanks for answer,

I’ve changed it to this but the function fetchProjects not being called

Here is the call

Screenshot 2023-07-03 at 18.40.08

@NarekMamikonyan could you try adding an await to the response.json()?

so something like:

const jsonResponse = await response.json();
return jsonResponse
1 Like