Hi all,
I’m in the process of moving our first (connect) app over to forge and am running into some issues getting a good dev-setup going.
I’ve got a basic build for a backend-function/resolver running within the forge emulator, but I’m unable to let it connect to our devtools over a websocket-connection.
I’ve read the docs on how to connect a debugger, but our tool is different and I didn’t get it to work that way.
The situation is as follows: once the build starts (inside the emulator), it tries to open a websocket connection to the server of our dev-tool that’s listening on a port on localhost. But the ws-handshake get’s denied with a 403 error.
I’ve got the impression this is due to the forge emulator blocking outbound traffic. I already tried adding permission for all outbound traffic to my manifest but this didn’t change anything.
Error log
ERROR 11:46:04.233 f91eb85e-c4ee-44e8-aab2-79dfdc4a6137 shadow-cljs - remote-error ErrorEvent {
target: WebSocket {
_events: [Object: null prototype] {
message: [Function],
open: [Function],
close: [Function],
error: [Function]
},
_eventsCount: 4,
_maxListeners: undefined,
_binaryType: ‘nodebuffer’,
_closeCode: 1006,
_closeFrameReceived: false,
_closeFrameSent: false,
_closeMessage: ‘’,
_closeTimer: null,
_extensions: {},
_protocol: ‘’,
_readyState: 2,
_receiver: null,
_sender: null,
_socket: null,
_bufferedAmount: 0,
_isServer: false,
_redirects: 0,
_url: ‘wss://localhost:9630/api/remote-relay?server-token=aa4dfd46-8995-4835-adc4-dcfc7559c4f7’,
_req: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
outputData: ,
outputSize: 0,
writable: true,
destroyed: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
strictContentLength: false,
_contentLength: 0,
_hasBody: true,
_trailer: ‘’,
finished: true,
_headerSent: true,
_closed: false,
socket: [TLSSocket],
_header: ‘GET /egress HTTP/1.1\r\n’ +
‘Sec-WebSocket-Version: 13\r\n’ +
‘Sec-WebSocket-Key: IoVQGB/Y6RnQ5tgl5+CEyA==\r\n’ +
‘Connection: Upgrade\r\n’ +
‘Upgrade: websocket\r\n’ +
‘Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\n’ +
‘forge-proxy-authorization: Bearer eyJhbGciOiJOEOUQ\r\n’ +
‘forge-proxy-target: https://localhost:9630/api/remote-relay?server-token=aa4dfd46-8995-4835-adc4-dcfc7559c4f7\r\n’ +
‘Host: forge-outbound-proxy.services.atlassian.com\r\n’ +
‘\r\n’,
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: undefined,
socketPath: undefined,
method: ‘GET’,
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
joinDuplicateHeaders: undefined,
path: ‘/egress’,
_ended: false,
res: [IncomingMessage],
aborted: true,
timeoutCb: null,
upgradeOrConnect: false,
parser: [HTTPParser],
maxHeadersCount: null,
reusedSocket: false,
host: ‘forge-outbound-proxy.services.atlassian.com’,
protocol: ‘https:’,
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false,
[Symbol(kBytesWritten)]: 0,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype],
[Symbol(errored)]: null,
[Symbol(kHighWaterMark)]: 16384,
[Symbol(kRejectNonStandardBodyWrites)]: false,
[Symbol(kUniqueHeaders)]: null,
[Symbol(kError)]: undefined
},
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false
},
type: ‘error’,
message: ‘Unexpected server response: 403’,
error: Error: Unexpected server response: 403
at ClientRequest. (webpack://edit-custom-field-values-forge/node_modules/ws/lib/websocket.js:783:1)
at ClientRequest.emit (node:events:531:35)
at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:698:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
at TLSSocket.socketOnData (node:_http_client:540:22)
at TLSSocket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23)
}
Allow all outbound traffic
permissions:
external:
fetch:
backend:
- ‘*’