"Network: (failed to request.DoUnencrypted)" error when signing in
Hi
I'm facing a problem to run 1password CLI on AWS Lambda function.
We have a custom container image based on AWS "lambda/nodejs:16" this is my DOCKERFILE
`
FROM alpine as download
RUN apk add curl unzip
ENV ARCH amd64
ENV OP_CLI_VERSION v2.14.0
RUN curl -sSfo op.zip https://cache.agilebits.com/dist/1P/op2/pkg/${OP_CLI_VERSION}/op_linux_${ARCH}_${OP_CLI_VERSION}.zip \
&& unzip -od /usr/local/bin/ op.zip \
&& rm op.zip
FROM node:16-alpine AS build
WORKDIR /usr/src
COPY package*.json ./
RUN npm ci
COPY tsconfig.json ./
COPY src/ ./src/
RUN npm run build
FROM node:16-alpine AS deps
WORKDIR /usr/src
COPY package*.json ./
RUN npm install --omit=dev
FROM public.ecr.aws/lambda/nodejs:16
RUN yum update
COPY --from=download /usr/local/bin/op /usr/local/bin/op
COPY --from=deps /usr/src/node_modules ${LAMBDA_TASK_ROOT}/node_modules/
COPY --from=build /usr/src/dist ${LAMBDA_TASK_ROOT}/src
COPY package*.json ${LAMBDA_TASK_ROOT}
WORKDIR /var/task/
CMD ["src/auth.handler"]
`
I configured the image so the configuration folder path is "/tmp/" and granted all folder, subfolders and file permissions as needed on CLI docs.
As I said, our code uses node16 and we are interacting with 1password CLI through child_process module.
When we execute the command "bash -c 'op account add --address ${address} --email ${email} --secret-key ${secretKey} --signin --raw'" the CLI responds with error "Could not determine supported authentication methods: Network: (Failed to request.DoUnencrypted), Validation: (400) (Bad request), The structure of the request was invalid."
I did the test of executing the command directly from the terminal of the container, it worked.
Anyone knows how to solve this problem?
1Password Version: 2.14.0
Extension Version: Not Provided
OS Version: Linux x86_64 - "lambda/nodejs:16"
Browser:_ Not Provided
Referrer: forum-search:failed to request.DoUnencrypted
Comments
-
I found the solution to the problem and part that was wrong in the code. Below is the applied solution.
execSync( `echo -n '${password}' | op account add --address ${subdomain} --email ${email} --secret-key ${secretKey} --signin --raw`, { env: { ...process.env, }, }, )
You can close
0