Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websocket-service error #15

Open
satonos opened this issue May 8, 2024 · 4 comments
Open

websocket-service error #15

satonos opened this issue May 8, 2024 · 4 comments

Comments

@satonos
Copy link

satonos commented May 8, 2024

Hi, I would like to help me about the error that was happend.
This error was happend on local development env when click "generate" of Looker dashboard.

SyntaxError: Unexpected token '<', ")
at parseJSONFromBytes (node:internal/deps/undici/undici:5584:19)
at successSteps (node:internal/deps/undici/undici:5555:27)
at fullyReadBody (node:internal/deps/undici/undici:1665:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async specConsumeBody (node:internal/deps/undici/undici:5564:7)
at async throwErrorIfNotOK (C:\Looker-extension-framework\dashboard-summarization\websocket-service\src\node_modules@google-cloud\vertexai\build\src\functions\post_fetch_processing.js:30:27)
at async generateContentStream (C:\Looker-extension-framework\dashboard-summarization\websocket-service\src\node_modules@google-cloud\vertexai\build\src\functions\generate_content.js:90:5)
at async Socket. (C:\Looker-extension-framework\dashboard-summarization\websocket-service\src\index.js:178:31)

@ryan-gould-accenture
Copy link

Hi Santonos,

Based on the log it looks like an issue in your index file when you pass the prompt and it doesn't like your '<' character. Without knowing more and assuming that you have not changed the queryPrompt text my guess would be that the bad value comes from your ${context} variable and that something in your dashboard contains that '<' character that is being read into your prompt.

@satonos
Copy link
Author

satonos commented May 17, 2024

Hi @ryan-gould-accenture ,

Thank you for advicing. Based on the logs, it seems that the error is caused by loading in HTML format, but there are no changes from the original code and the cause is unknown. Do you know any solutions?

Listening on:  5000
initial transport websocket
Response {
  [Symbol(realm)]: null,
  [Symbol(state)]: {
    aborted: false,
    rangeRequested: false,
    timingAllowPassed: true,
    requestIncludesCredentials: true,
    type: 'default',
    status: 404,
    timingInfo: {
      startTime: 8430.9682,
      redirectStartTime: 0,
      redirectEndTime: 0,
      postRedirectStartTime: 8430.9682,
      finalServiceWorkerStartTime: 0,
      finalNetworkResponseStartTime: 0,
      finalNetworkRequestStartTime: 0,
      endTime: 0,
      encodedBodySize: 1159,
      decodedBodySize: 1159,
      finalConnectionTimingInfo: null
    },
    cacheState: '',
    statusText: 'Not Found',
    headersList: HeadersList {
      cookies: null,
      [Symbol(headers map)]: [Map],
      [Symbol(headers map sorted)]: null
    },
    urlList: [ URL {} ],
    body: { stream: undefined }
  },
  [Symbol(headers)]: HeadersList {
    cookies: null,
    [Symbol(headers map)]: Map(6) {
      'content-type' => [Object],
      'referrer-policy' => [Object],
      'content-length' => [Object],
      'date' => [Object],
      'alt-svc' => [Object],
      'connection' => [Object]
    },
    [Symbol(headers map sorted)]: null
  }
}
undefined:1
<!DOCTYPE html>
^

SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

@LukaFontanilla
Copy link
Collaborator

@satonos, where is this happening? When running locally or when deploying? That error is from the authentication and call to the Gemini SDK. Auth likely failed.

If you are deploying via the terraform make sure to set the PROJECT & REGION TF Variables. If hitting locally or when deploying manually with gloud run deploy you'll need to ensure the variables (your GCP Project ID and Region) at this line are set ->

const vertexAI = new VertexAI({project: process.env.PROJECT, location: process.env.REGION});

@satonos
Copy link
Author

satonos commented Jun 7, 2024

@LukaFontanilla
Thank you for your guidance. I was able to successfully display the summary after making the changes you suggested in the local environment. However, I am unable to obtain any information after clicking the "Generate" button. I understand that a cookie error is occurring, but I believe that this is unrelated to the current issue. Could you please provide any advice regarding this matter?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants