Get webtriger url does no t work

Hi, i generated a web trigger, so i want the user can see the URL of the webtrigger so he can copy the WebTrigger URL.

i got something like that

import api, { webTrigger, storage } from "@forge/api";
import ForgeUI, { Table, Head, Row, Cell, useState, useEffect, Text, Button, ButtonSet, Fragment, Tag, Badge, SectionMessage } from '@forge/ui';

export default function MyFunction() {
  const [trigger] = useState(async () => await webTrigger.getUrl("webtrigger-key"))

  return (
  <Fragment>
     <Text>{trigger}</Text>
   </Fragment>
 )
}

and always i get this error
Captura

Hi,

Cheers for the code sample. That has made recreating the problem easier.

Unfortunately I’m struggling to do so. I’m able to print the webtrigger url myself.

Steps I used.

  1. Create new app (UIKit like your own)
  2. cd into forge app
  3. npm install @forge/api
  4. Change src/index.jsx to what you had above but with render imported from @forge/ui
  5. forge deploy not using forge deploy -e {staging,production}
  6. forge install

When you run the above steps yourself what happens?

3 Likes

Hi, i make it works, but i need to remove all my packages of npm, update the forge cli and reinstall all the NPI.

1 Like