Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator)): onboarding.js #28

Open
teamallnighter opened this issue Mar 24, 2020 · 1 comment

Comments

@teamallnighter
Copy link

/Users/XXX/XXX/prismic/nodejs-sdk-master/onboarding.js:6
  const [_, endpoint] = PrismicConfig.apiEndpoint.match(repoRegexp);
                        ^

TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
    at Object.trigger (/Users/chrisconnelly/Development/prismic/nodejs-sdk-master/onboarding.js:6:25)
    at Server.<anonymous> (/Users/chrisconnelly/Development/prismic/nodejs-sdk-master/app.js:11:14)
    at Object.onceWrapper (events.js:298:28)
    at Server.emit (events.js:209:13)
    at emitListeningNT (net.js:1332:10)
    at processTicksAndRejections (internal/process/task_queues.js:79:21)

nodejs-sdk-master/onboarding:

const PrismicConfig = require('./prismic-configuration');
const request = require('request');

function trigger() {
  const repoRegexp = /^(https?:\/\/([-\w]+)\.[a-z]+\.(io|dev))\/api(\/v2)?$/;
  const [_, endpoint] = PrismicConfig.apiEndpoint.match(repoRegexp);
  request.post(`${endpoint}/app/settings/onboarding/run`, { form: { language: 'node', framework: 'express' } });
}

module.exports = {
  trigger,
};

prismic-configuration.js:

module.exports = {
  apiEndpoint: 'https://web-dev-bible.cdn.prismic.io/api/v2',
  accessToken: 'ACCESS TOKEN',

  // OAuth
  // clientId: 'xxxxxx',
  // clientSecret: 'xxxxxx',

  // -- Links resolution rules
  // This function will be used to generate links to Prismic.io documents
  // As your project grows, you should update this function according to your routes
  linkResolver(doc) {
    if (doc.type === 'post') {
      return `/posts/${doc.uid}`;
    }

    return '/';
  },
};
@AfvanMoopen
Copy link

the way is to remove that repoRegexp and get it to working

worked for me

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

No branches or pull requests

2 participants