Contentful logo

Contentful Community

What am I missing? Getting "The resource could not be found" with JS SDK + new API key

Hey there,

I am following the directions to use the JS SDK and am getting an error on the most simple setup.

  • Install Contentful API

  • Set up Contentful API key (and note space, and access token, access to all envs)

  • Publish some entries

  • Call .getEntries()

    const client = require(“contentful”).createClient({
    space: space,
    accessToken: accessToken,

    });
    client.getEntries()

  • I have tried in a codesandbox, runkit an explicit call to createClient with the space and key. Have also tried an explicit getEntry(‘id’) but same error.

I can’t seem to simplify this example and I am completely stuck.

Given it is the absolute bare minimum example, I am under the impression I must be missing something obvious.

Thank you!

Update: Tried with another account, and it works. Wonder what possible configuration gotchas are here. getEntries() returns all published entries, right?

Solved: removed “training wheels” on main contentful app page by clicking “start with my own content” and all works as expected. @contentful I suspect you have an issue with content not appearing via API until one proceeds past the “Delete space or Load demo content” step, even though users are able to enter content as usual. If users are able to enter content but the basic API queries don’t work until users click a button on the main page, I think many people will get stuck.