i have a custom resource that has a `read` functio...
# typescript
w
i have a custom resource that has a
read
function like this:
Copy code
async read(id: string) {
    pulumi.log.warn('READING');
    try {
      const result = await axios.get<
        BetterUptimeResponse<MonitorProviderInputs>
      >(`<https://betteruptime.com/api/v2/monitors/${id}>`, {
        headers: authHeaders,
      });
      return { id: result.data.data.id, props: result.data.data.attributes };
    } catch (e) {
      throw new Error('Failure');
    }
  },
this causes
pulumi refresh
to fail when the request returns a 404. i'm attempting to debug, and i'm noticing some weird behaviour -- if i catch the error, or if i try throwing an error at the beginning of this
read
function, my pulumi output always returns the same error:
Copy code
pulumi:pulumi:Stack (cinder_app-gooseberry):
    AxiosError: Request failed with status code 404: AxiosError: Request failed with status code 404
        at settle (/Users/tao/dev/infra/node_modules/axios/dist/node/axios.cjs:1913:12)
        at BrotliDecompress.handleStreamEnd (/Users/tao/dev/infra/node_modules/axios/dist/node/axios.cjs:3008:11)
        at BrotliDecompress.emit (node:events:525:35)
        at endReadableNT (node:internal/streams/readable:1359:12)
        at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

    error: preview failed
can anyone shed some light on this? it's as if my typescript changes aren't actually having an effect.
f
I might be mistaken, but I think
pulumi refresh
doesn't recompile projects, but rather just uses the already existing state. To be certain your latest code is being used, you may want to either use
pulumi up
, or, to be very sure, destroy and recreate the stack every time