@enfyra/sdk-nuxt 0.3.28 → 0.3.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "0.3.28",
7
+ "version": "0.3.30",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../../src/runtime/utils/server/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,IAAI,CAAC;AAa3C,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,4BA4B7D"}
1
+ {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../../src/runtime/utils/server/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,IAAI,CAAC;AAa3C,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,4BAgC7D"}
@@ -16,8 +16,9 @@ export function proxyToAPI(event, customPath) {
16
16
  const headers = event.context.proxyHeaders || {};
17
17
  const isWebSocket = event.node.req.headers["upgrade"]?.toLowerCase() === "websocket";
18
18
  if (isWebSocket) {
19
+ event.node.req.url = rawPath;
19
20
  proxy.web(event.node.req, event.node.res, {
20
- target: targetUrl,
21
+ target: config.public?.enfyraSDK?.apiUrl || process.env.API_URL || "http://localhost:1105",
21
22
  ws: true,
22
23
  changeOrigin: true,
23
24
  headers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfyra/sdk-nuxt",
3
- "version": "0.3.28",
3
+ "version": "0.3.30",
4
4
  "type": "module",
5
5
  "description": "Nuxt SDK for Enfyra CMS",
6
6
  "repository": {
@@ -24,10 +24,14 @@ export function proxyToAPI(event: H3Event, customPath?: string) {
24
24
  const isWebSocket = event.node.req.headers['upgrade']?.toLowerCase() === 'websocket';
25
25
 
26
26
  if (isWebSocket) {
27
- // For WebSocket, use http-proxy directly and return immediately
28
- // The proxy will handle the upgrade asynchronously
27
+ // Modify req.url to remove the apiPrefix before proxying
28
+ // The incoming request is /api/chat/test-room but backend expects /chat/test-room
29
+ // Don't restore since proxy.web() is async
30
+ event.node.req.url = rawPath;
31
+
32
+ // For WebSocket, use http-proxy directly
29
33
  proxy.web(event.node.req, event.node.res, {
30
- target: targetUrl,
34
+ target: config.public?.enfyraSDK?.apiUrl || process.env.API_URL || 'http://localhost:1105',
31
35
  ws: true,
32
36
  changeOrigin: true,
33
37
  headers,