I’m developing a Forge app using Custom UI, and I’d like to be able to run it locally (to speed up development). Currently I’m having to do npm run build
followed by forge deploy
each time, which is fine but takes ages. I’ve previously set up the locally-run version for other apps, but it’s been 6 months or so and now that I’ve come back to it I can’t get it to work.
So, I’ve gone into the static/my-app
folder and run npm run start
. This appears to run ok, with no warnings or errors. The browser window opens to localhost/3000, and is blank, as expected.
I then go to the root folder and run forge deploy
; again this seems to complete with no issues.
Finally, again from the root folder, I run forge tunnel
, and again everything looks fine.
However, then I try to add the macro to a page on Confluence, and I just see the message “Error: Failed to connect to localhost:3000. Check that your service is running.” (this message also appears in the console.
I didn’t initially have Docker running, but when I opened it and tried everything again, I had exactly the same results. Docker is not showing any open containers - I don’t know whether it’s supposed to though?
I’m using @forge/cli version 7.0.3, @forge/ui 1.11.1, npm 9.6.7 and node v18.17.1.
I’m not sure what else is relevant, but I can provide more information on my setup if needed.
Can you share your manifest? Also, Docker is no longer needed.
Thanks for your response. My manifest is as follows:
modules:
macro:
- key: macro-name
resource: main
resolver:
function: resolver
title: "Macro name"
description: macro description
config:
function: config
function:
- key: resolver
handler: index.handler
providers:
auth:
- ms-graph
- key: config
handler: config.config
resources:
- key: main
path: static/macro-name/build
remotes:
- key: microsoft-account
baseUrl: https://login.microsoftonline.com
- key: microsoft-graph
baseUrl: https://graph.microsoft.com
providers:
auth:
- key: ms-graph
name: MS-Graph
scopes:
- "https://graph.microsoft.com/User.Read"
- "https://graph.microsoft.com/Calendars.ReadBasic"
type: oauth2
clientId: xxxxxxxx
remotes:
- microsoft-account
- microsoft-graph
bearerMethod: authorization-header
actions:
authorization:
remote: microsoft-account
path: /organizations/oauth2/v2.0/authorize
exchange:
remote: microsoft-account
path: /organizations/oauth2/v2.0/token
revokeToken:
remote: microsoft-graph
path: /v1.0/me/revokeSignInSessions
retrieveProfile:
remote: microsoft-graph
path: /v1.0/me
resolvers:
id: id
displayName: mail
permissions:
scopes:
- "read:confluence-props"
- "write:confluence-props"
external:
fetch:
backend:
- "https://graph.microsoft.com"
- "https://login.microsoftonline.com"
content:
styles:
- "unsafe-inline"
scripts:
- "unsafe-inline"
- "unsafe-eval"
app:
id: ari:cloud:ecosystem::app/xxxxxxxx
runtime:
name: nodejs18.x
Consider to upgrade forge cli to latest version, it is now 10.3. It is not confirmed fix your problem but it might help the investigation
Hey @SharonGilmore, I think this is due to a bug with Node related to DNS lookups for localhost
. Can you try updating your version of Node to v20 and see if that helps?
3 Likes
Thank you - that has fixed it!
Thanks, I do have that in; had just temporarily removed it to see whether that fixed it!
1 Like