hey guys, a quick question. Am trying to enable `C...
# graphql-nexus
a
hey guys, a quick question. Am trying to enable
CORS
on my nexus server:
Copy code
import { settings, use } from "nexus";

settings.change({
  server: {
    cors: {
      origin: "*",
    },
  },
});
But when I try to make a request from the FE I get:
Copy code
{
  "event": "CORS does not work for serverless handlers. Settings will be ignored.",
  "level": 4,
  "path": [
    "nexus",
    "server"
  ]
}
Anyone know how I could fix this?
r
Is your request successful? As this might just be a warning. Also have a look at this as I had previously sent you https://prisma.slack.com/archives/CKQTGR6T0/p1603816441378100?thread_ts=1603810263.376300&cid=CKQTGR6T0
a
Nope, this request fails
and yup, we'll be moving to nexus/schema in the next couple of days. Do you thinking doing that first will solve this cors issue?
r
You would be using either Apollo Server or GraphQL Yoga instead, so that would definitely solve it.
Let me still check this though for the framework.
a
perfect, thanks!
r
I’m not getting the above message that you are seeing. Are you testing this locally or is it deployed someplace else?
a
testing it locally
I'm just about to start work on moving to nexus/schema, will let you know it still persists after that
💯 1
Hey @Ryan 🙂 I'm moving to
@nexus/schema
and having been following this example to get it to deploy on vercel. Running the build locally works fine but on vercel it gives the following error stack:
Copy code
21:56:36.441  	Error: Cannot find module 'nexus/components/schema'
21:56:36.441  	Require stack:
21:56:36.441  	- /vercel/workpath0/src/graphql/event_request/query.ts
21:56:36.441  	- /vercel/workpath0/src/graphql/event_request/index.ts
21:56:36.441  	- /vercel/workpath0/src/schema.ts
21:56:36.441  	    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
21:56:36.441  	    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
21:56:36.442  	    at Module.require (internal/modules/cjs/loader.js:1025:19)
21:56:36.442  	    at require (internal/modules/cjs/helpers.js:72:18)
21:56:36.442  	    at Object.<anonymous> (/vercel/workpath0/src/graphql/event_request/query.ts:3:1)
21:56:36.442  	    at Module._compile (internal/modules/cjs/loader.js:1137:30)
21:56:36.442  	    at Module.m._compile (/vercel/workpath0/node_modules/ts-node/src/index.ts:1043:23)
21:56:36.442  	    at Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
21:56:36.442  	    at Object.require.extensions.<computed> [as .ts] (/vercel/workpath0/node_modules/ts-node/src/index.ts:1046:12)
21:56:36.442  	    at Module.load (internal/modules/cjs/loader.js:985:32)
21:56:36.490  	error Command failed with exit code 1.
21:56:36.490  	info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.
21:56:36.500  	Error: Command "yarn run vercel-build" exited with 1
any idea what could be causing this?
r
It seems that you still have
nexus
being used somewhere?
a
hey yup, that was the issue. Thank you!
💯 1