Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.
This repository was archived by the owner on Nov 7, 2023. It is now read-only.

🐛 Gateway Timeout when trying to post an invalid ImageUrl #3

@ulfgebhardt

Description

@ulfgebhardt

image

{
error: "Cannot create post. Error: Gateway Time-out",
succeeded: false
}
import { User, connect } from 'human-connection-api-nodejs-client';
import mongoose from 'mongoose';
import slugify from 'slugify';
import CONSTANTS from '../../../config/constants';
import { getImage } from './subjectGroupToIcon';

async function contributeProcedure({ procedureId, email, password }) {
  connect(CONSTANTS.HC_BACKEND_URL);
  const ProcedureModel = mongoose.model('Procedure');
  if (procedureId && email && password) {
    const procedure = await ProcedureModel.findOne({ procedureId });
    if (procedure) {
      const user = new User({ email, password });
      return user.contribute(
        {
          title: procedure.title,
          content: procedure.abstract,
          contentExcerpt: procedure.abstract,
          type: 'post',
          language: 'de',
          teaserImg: `https://www.democracy-app.de/static/images/sachgebiete/${getImage(
            procedure.subjectGroups[0],
          )}_1920.jpg`,
        },
        {
          slug: slugify(procedure.title, { lower: true }),
          resolveSlugs: {
            categories: ['democracy-politics'],
            // organization: CONSTANTS.HC_ORGANIZATION_SLUG,
          },
        },
      );
    }
    throw Error('No procedure found.');
  } else {
    throw Error('Please provide procedureId, email and password.');
  }
}

See: https://github.com/demokratie-live/democracy-server/blob/hc_webhook/src/express/webhooks/socialmedia/humanconnection.js

This error occurs when the URL to the teaserImage is invalid ?!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions