# INVALID\_TARGET\_URL when trying to get bitbucket user

**URL:** <https://community.developer.atlassian.com/t/invalid-target-url-when-trying-to-get-bitbucket-user/90521>\
**Category:** Forge Modules and Product Triggers\
**Tags:** rest-api, forge\
**Created:** [March 21, 2025, 2:43pm UTC](https://community.developer.atlassian.com/t/invalid-target-url-when-trying-to-get-bitbucket-user/90521 "2025-03-21T14:43:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![awagner](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@awagner](https://community.developer.atlassian.com/u/awagner)\
**Post date:** [March 21, 2025, 2:43pm UTC](https://community.developer.atlassian.com/t/invalid-target-url-when-trying-to-get-bitbucket-user/90521/1 "2025-03-21T14:43:00Z")

</div>

I am trying to create my first Forge app. I use UI kit to offer a settings page which uses `UserPicker` to select a group of users, which returns account IDs. As other bitbucket REST APIs (for example the `author` field of `/repositories/{workspace}/{repo_slug}/pullrequests/{pull_request_id}`) do not include that, but only a `uuid` and I need to compare authors, I am trying to map the account ID to a UUID or vice-versa.

In the resolver of my app, I thus have this simple function:

```ts
const getUUID = async (id: AccountID): Promise<void | UUID> => {
	return api.asApp().requestBitbucket(route`/2.0/users/${id}`)
		.then((r) => r.json())
		.then((u: User) => u.uuid);
};

```

However, trying to use it throws an `INVALID_TARGET_URL` exception. I’ve tried logging the `route` including the `id`. If I use that to send a request using `curl`, it works as expected and returns the user data I am interested in.

I thought I might be missing permissions, but it seems that endpoint is just publicly readable.

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![awagner](https://avatars.discourse-cdn.com/v4/letter/a/f07891/32.png) [@awagner](https://community.developer.atlassian.com/u/awagner)\
**Post date:** [March 24, 2025, 10:42am UTC](https://community.developer.atlassian.com/t/invalid-target-url-when-trying-to-get-bitbucket-user/90521/2 "2025-03-24T10:42:13Z")

</div>

I figured out what I was doing wrong. As the request does not require authentication, I need to remove the `asApp()`. This works as expected:

```ts
const getUUID = async (id: AccountID): Promise<undefined | UUID> => {
	return api.requestBitbucket(route`/2.0/users/${id}`)
		.then((r) => r.json())
		.then((u: User) => u ? u.uuid.slice(1,-1) as UUID : undefined);
};

```

The error message is pretty confusing. But at least my problem is solved now.
