Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

391
Views
CORS no funciona en AWS Lambda (expressAppFromMiddleware)

este es mi backend index.js en AWS Lambda. Ya probé CORS de todas las formas que conocemos, pero aún no funciona. TT, ¿debo configurar algo en AWS primero?

 const { ApolloServer, gql } = require('apollo-server-lambda') const express = require('express'); const cors = require('cors'); const jwt = require('express-jwt'); const cookieParser = require('cookie-parser'); const schema = require('./graphql'); const mongoose = require('mongoose'); const path = "/graphql"; const server = new ApolloServer({ schema, context: ({ event, context }) => ({ headers: event.headers, functionName: context.functionName, event, context, }) }); exports.handler = server.createHandler({ expressGetMiddlewareOptions: { cors: { origin: "http://localhost:3000", credentials: true, } }, expressAppFromMiddleware(middleware) { const app = express(); const mongodb_uri = "mongodb+srv://###############################################" mongoose.Promise = Promise; mongoose.connect(mongodb_uri, { dbName: "myDB", promiseLibrary: Promise, useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, useFindAndModify: false, }); app.use(cookieParser()); app.use(express.json()); app.use(express.urlencoded({ extended: false })); app.use( cors({ origin: "http://localhost:3000", credentials: true, }) ); });

cuando llamo al backend desde http://localhost:3000 (frontend), obtenemos un error

 Access to fetch at 'https://####################################' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. createHttpLink.ts:145 POST https://#################################### net::ERR_FAILED
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!