monorise 1.6.1 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import type { NextRequest } from 'next/server';
2
+ import { Resource } from 'sst';
2
3
 
3
4
  function rewriteUrl({
4
5
  requestUrl,
@@ -39,7 +40,7 @@ export const proxyRequest = async ({
39
40
  body,
40
41
  headers: {
41
42
  ...reqHeaders,
42
- 'x-api-key': process.env.API_KEY ?? '',
43
+ 'x-api-key': Resource.X_API_KEY.value,
43
44
  },
44
45
  cache: 'no-store',
45
46
  },
@@ -15,15 +15,16 @@ export default $config({
15
15
  const { api } = new monorise.module.Core('core', {
16
16
  allowOrigins: ['http://localhost:3000'],
17
17
  });
18
+ // Must match one entry in Core's API_KEYS secret (defaults to
19
+ // ["secret1", "secret2"]). Override both before deploying:
20
+ // npx sst secret set X_API_KEY '...' && npx sst secret set API_KEYS '["..."]'
21
+ const xApiKey = new sst.Secret('X_API_KEY', 'secret1');
18
22
 
19
23
  new sst.aws.Nextjs('web', {
20
24
  path: 'apps/web',
25
+ link: [api, xApiKey],
21
26
  environment: {
22
27
  API_BASE_URL: api.url,
23
- // Must match one of the values in the backend's API_KEYS secret
24
- // (defaults to ["secret1", "secret2"] — override both with
25
- // `npx sst secret set API_KEYS '["..."]'` before deploying).
26
- API_KEY: 'secret1',
27
28
  },
28
29
  });
29
30
  },
@@ -7344,7 +7344,7 @@ var UpdateEntityController = class {
7344
7344
  details: err.flatten()
7345
7345
  });
7346
7346
  }
7347
- if (err instanceof StandardError && err.code === StandardErrorCode.ENTITY_NOT_FOUND) {
7347
+ if (err instanceof StandardError && (err.code === StandardErrorCode.ENTITY_NOT_FOUND || err.code === StandardErrorCode.ENTITY_IS_UNDEFINED)) {
7348
7348
  c.status(httpStatus8.NOT_FOUND);
7349
7349
  return c.json(__spreadValues({}, err.toJSON()));
7350
7350
  }