Hi, I’m using ApolloApi with nexus and prisma and ...
# help
m
Hi, I’m using ApolloApi with nexus and prisma and next.js and some recent additions are causing some issues when deploying via seed. I have 2 stacks - one for the next.js client and one for my server components (ApolloApi and a queue and a consumer lambda) I am getting this error in CloudWatch which is manifesting in the client as a 503 error:
Copy code
undefined ERROR Error: Root typing path "/var/task/src/context.ts" for the type "context" does not exist
So any attempts to invoke the API routes from my Next.js client results in the above being written into Cloudwatch. Has anyone seen this error before, and would you be able to point me in a direction of solving it ? For reference the schema for Apollo is as follows:
Copy code
export const schema = makeSchema({
  types,
  outputs: {
    schema: path.join(process.cwd(), 'src', 'generated', 'schema.gen.graphql'),
    typegen: path.join(process.cwd(), 'src', 'generated', 'nexus-types.gen.ts'),
  },
  plugins: [fieldAuthorizePlugin()],
  contextType: {
    module: path.join(process.cwd(), 'src', 'context.ts'),
    export: 'ContextType',
    alias: 'ctx',
  },
});
t
Hey Mark - will need Frank to chime in as he's more familiar with the nextjs construct.
Although this sounds more like an issue with the ApolloApi construct. Is this in local debugging mode?
m
Hey, its in all modes from local debugging through to seed deployment. In all cases the API is accessible and functional, its just the client api routes domain.com/api/xxx are failing with the above error
t
Ah gotcha, this sounds similar to what @Yousef was asking about so will let Frank chime in when he has a sec
f
Thanks @thdxr. Hey @Mark Faulkner, are the Next.js api routes failing only inside
sst start
? It you stopped
sst start
and then do a
sst deploy
, the api routes works right?
y
Should they work with
sst start
i figured that workflow was unsupported
m
The entire site shows a placeholder page when using
sst start
and asks for an
sst deploy
to be run
So I’ve determined the issue - its related to the version of SST and the AWS CDK. I am unable to use a version of SST above 0.45.2 otherwise the error appears. So i’ve had to peg my application at this version for now
f
hmm… there hasn’t be any significant changes to the
NextjsSite
since 0.45.2.
I’m a bit confused, can you confirm that you were getting the
undefined ERROR Error: Root typing path "/var/task/src/context.ts" for the type "context" does not exist
error when hitting the apis in your Next.js app’s
pages/api
when running
sst start
?
m
So this seems to be all solved now running on the latest 0.49.2 build. Everything was fine with earlier versions when running via localhost but it was with a domain name (and deployed via Seed) that the issues started.
f
Oh I see. Glad it’s working!