Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

React server side rendering: unable to verify the first certificate #1089

@JoshClose

Description

@JoshClose

I'm running on https. I can't seem to figure out why I'm getting this error. Everything looks roughly the same to me as the code generated from using yo to create a react/redux app. If I remove the [Authorize] app from the controller, the issue still happens. I've read this is supposed to work on this issue #851. Zone.js isn't in my stack because i'm using fetch from domain-task.

This is the error

Call to Node module failed with error: FetchError: request to https://localhost:44346/api/contracts failed, reason: unable to verify the first certificate
    at ClientRequest.<anonymous> (C:\Users\...\ClientApp\dist\vendor.js:44324:11)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at TLSSocket.socketErrorListener (_http_client.js:309:9)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7)
    at emitErrorNT (net.js:1277:8)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)

This is my controller

[Route( "api/[controller]" )]
[Authorize]
public class ContractController : Controller
{
	private readonly ApplicationDbContext context;

	public ContractController( ApplicationDbContext context )
	{
		this.context = context;
	}

	[HttpGet( "/api/contracts" )]
	public object GetContracts()
	{
		var contracts = context.Contracts.ToList();

		return new
		{
			Contracts = contracts
		};
	}
}

This is the js calling it

import { fetch, addTask } from "domain-task"

export const FETCH_CONTRACTS = "ContractActions/FetchContracts"

export const fetchContracts = () => dispatch => {
	let fetchTask = fetch("/api/contracts", {
		method: "GET",
		credentials: "same-origin",
		headers: {
			"Content-Type": "application/json"
		}
	}).then(response => response.json()).then(data => {
		dispatch({
			type: FETCH_CONTRACTS,
			contracts: data.contracts
		});
	});

	addTask(fetchTask);
	dispatch({ type: FETCH_CONTRACTS });
}

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