upstash / vector-js

Upstash Vector JS SDK
https://docs.upstash.com/vector
MIT License
43 stars 6 forks source link

UpstashError: Forbidden: /upsert-data is not allowed #33

Closed johnbenedictyan closed 5 months ago

johnbenedictyan commented 5 months ago

I'm receiving this error

UpstashError: Forbidden: /upsert-data is not allowed

when I'm trying to insert data into a vector database in my JavaScript code.

const result = await this.vectorIndex.upsert({id: "testId", data:"testData"});

this.vectorIndex is just an abstraction of new Index({ url, token })

This is the stack trace of the error

at f.request (/.../node_modules/.pnpm/@upstash+vector@1.1.1/node_modules/@upstash/vector/dist/index.js:52:26)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at d.exec (/.../node_modules/.pnpm/@upstash+vector@1.1.1/node_modules/@upstash/vector/dist/index.js:63:39)

Is there something wrong with my code or my settings in my upstash project?

ogzhanolguncu commented 5 months ago

Well everything looks okay. Can you share a repo or gist?

johnbenedictyan commented 5 months ago

https://github.com/johnbenedictyan/example-upstash-vector here is a link to an example repo I made the error appears when I access the main route localhost:3000, do let me know if there is any other information you need!

ogzhanolguncu commented 5 months ago

Well, everything worked fine on my end. I know why you are seeing this issue. Your index probably created without custom embedding model?

image

My index has this: image

Can you please try to create a new index with embedding model?

mdogan commented 5 months ago

@johnbenedictyan could it be that you're trying to upsert with the readonly credentials?

ogzhanolguncu commented 5 months ago

@johnbenedictyan Make sure you are not using readonly token and you have embedding model active in your index. That should do the trick.

johnbenedictyan commented 5 months ago

Ah yes, @mdogan I copied the readonly token, my bad it works now, thanks for your time! @mdogan @ogzhanolguncu