Welcome to the community I’ll be happy to debug this with you.
Are you passing in your Prismic repository endpoint when running Prismic.getApi()?
For example: Prismic.getApi("http://your_repository_name.prismic.io/api")
Or like is shown in the docs:
Prismic.api("http://your_repository_name.prismic.io/api", function(error, api) {
var options = {}; // In Node.js, pass the request as 'req' to read the reference from the cookies
api.query("", options, function(err, response) { // An empty query will return all the documents
if (err) {
console.log("Something went wrong: ", err);
}
console.log("Documents: ", response.documents);
});
});
var Prismic = require('prismic-javascript');
console.log(Prismic);
Prismic.api("https://mywebsitename.prismic.io/api", function(error, api) {
var options = {}; // In Node.js, pass the request as 'req' to read the reference from the cookies
api.query("", options, function(err, response) { // An empty query will return all the documents
if (err) {
console.log("Something went wrong: ", err);
}
console.log("Documents: ", response.documents);
});
});