Snapshot error when using Forge Custom UI

Forge Custom UI Issue

I am using Forge custom UI and trying to get the backend to work using the resolver. But I keep getting this snapshot error when I run forge deploy.

Note: This error that am getting is indicative of nothing useful

Error Message:

Error: Error thrown in the snapshot context.
App code snapshot error: Snapshot error occurred: Error: ENOENT: no such file or directory, open 'node_modules\vietnamese-stopwords/vietnamese-stopwords.txt'

Manifest File:

modules:
  macro:
    - key: blurred
      resource: main
      resolver:
        function: resolver
      title: blurred
      description: blurred
  function:
    - key: resolver
      handler: index.handler

resources:
  - key: main
    path: static/CW/build
    tunnel:
      port: 3000
permissions:
  scopes:
    - read:confluence-content.summary
    - read:confluence-space.summary
    - read:page:confluence
  content:
    styles:
      - unsafe-inline
  external:
    fetch:
      client:
        - '*'
      backend:
        - '*'

app:
  id: blurred
```.

You should probably add the content (if it isn’t sensitive) of your snapshot function.

That error actually looks interesting:
node_modules\vietnamese-stopwords/vietnamese-stopwords.txt
The first path separator is a \, while the second one is a /, maybe you’re developing on Windows and you’re using the wrong kind of /? On Linux (where snapshots – as well as other functions – are executed) you should be using the forward slash.

Most likely you have somewhere in your code an import, a require or a fs.open which includes a mixture of different path separators, but without the code it’s hard to say

1 Like

Yes I am working on windows. After troubleshooting, the error appeared to be related to the TFIDF library I was using to index the data.

Not sure if there is another library that is compatible with forge custom UI and doesn’t give errors.
Because I used the same library on AWS Faas and did not face this issue.

This is the library node-tfidf