text:
Snowflake doesn't allow revoke OWNERSHIP anymore

Hello guys,
Since last Snowflake update, revoke ownership is not available anymore. Only transfering ownership from one user/role to another.
Now, resource snowflake_schema_grant won't work if we try to change ownership of a schema, since it will try to revoke it first.
Guess we can change revoke code to, instead, grant ownership to the role terraform is using. But i don't know how to get that.
grant.go
// Revoke returns the SQL that will revoke privileges on the grant from the grantee
func (ge *CurrentGrantExecutable) Revoke(p string) string {
    if p == `OWNERSHIP` {
        return fmt.Sprintf(`GRANT %v ON %v %v TO ROLE "ACCOUNTADMIN" COPY CURRENT GRANTS`,
        p, ge.grantType, ge.grantName)
    } else {
        return fmt.Sprintf(`REVOKE %v ON %v %v FROM %v "%v"`,
            p, ge.grantType, ge.grantName, ge.granteeType, ge.granteeName)
    }
}

I added this if p == OWNERSHIP to explicit what could be done. If instead of hardcoding ACCOUNTADMIN , we could retrieve terraform's role, problem should be solved.

A stop-gap solution could be the following:
func (ge *CurrentGrantExecutable) Revoke(p string) string {
	if p == `OWNERSHIP` {
		currentRole := os.Getenv(`SNOWFLAKE_ROLE`)

		if currentRole != "" {
			return fmt.Sprintf(`GRANT OWNERSHIP ON %v %v TO ROLE "%v" COPY CURRENT GRANTS`,
				ge.grantType, ge.grantName, currentRole)
		}
	}
	return fmt.Sprintf(`REVOKE %v ON %v %v FROM %v "%v"`,
		p, ge.grantType, ge.grantName, ge.granteeType, ge.granteeName)
}

here we obtain the current role from the SNOWFLAKE_ROLE environment variable.  That's the only place where the current role is accessible at this point.  However, this doesn't work for cases where the role is supplied through terraform config or if no role is supplied and the default role for the user is utilized.
Alternatively within the ConfigureProvider method of pkg/provider/provider.go, we can issue the query of SELECT CURRENT_ROLE() and use the result elsewhere.  The cleanest way of threading things through would be to utilize the meta value for the provider.  That would require changes all over the code as there's an assumption that the meta field is of type sql.DB.
Any thoughts on this?

Amazing @a129722 ! So we have quite some ways to fix this problem. @ryanking @edulop91 Do you guys have any thoughts on the best way to proceed?

cc also @alldoami
Can you clarify for me - is this something that snowflake changed? or that we changed in the provider?

@ryanking In october update, Snowflake stopped alowing revoke of ownership.
From their documentation:

Transfers ownership of an object (or all objects of a specified type in a schema) from one role to another role. OWNERSHIP is a special type of privilege that can only be granted from one role to another role; it cannot be revoked. For more details, see Access Control in Snowflake.

Ok thanks. I am currently thinking that we set to CURRENT_ROLE(). Thoughts?

Setting to CURRENT_ROLE() makes sense, but we do need to obtain what the value is and supply it to the Revoke method.  Unfortunately the statement of GRANT OWNERSHIP ON TABLE MY_TABLE TO ROLE CURRENT_ROLE() does not work.

This should be fixed by #360.

authors: a129722 lgwacker ryanking


text:
Will you provide use example or docs.

I'm trying to POST some data. But don't know how to send data or what should I add to body field.
Basically I'm asking. How to use?

是啊 整个文档或者demo吧， post数据 填不明白，后来我换成了 curl -d '{"key": "value}' url.
哭。。。

source: gharchive/issue

authors: ClayAndMore vin-sha

repo: chao/RESTClient

license_type: permissive

license_source: bigquery


text:
No such file or directory

When I run the workflow i get this error:
[Errno 2] No such file or directory: 'D:\\Ai__Project\\ComfyUI\\custom_nodes\\ComfyUI-MuseV\\data/images/cluk7fgii0001m0ul2pqetdsy.jpg'
what am I missing?

me too

create folder data\images

mkdir a data\images  floder,it can resolve your problem.

I created the folers and it work but I this shoud be clear on the repo read me page too
Thanks @w4l6 @Pythonpa

repo: chaojie/ComfyUI-MuseV

license: MIT

license_source: github-api


text:
Add used distro to readme

Related to https://github.com/chaosbot/chaos/pull/7
Distro revealed by https://github.com/chaosbot/chaos/pull/2 -> https://github.com/chaosbot/chaos/pull/4#issuecomment-303289802

Isn't this already in PR #15?
👎

Hmm yes, couldn't find it due to the insane way of writing the PR title.

chaos!

source: gharchive/pull-request

authors: MonkeeSage jabbink

repo: chaosbot/chaos


text:
[Handbook] Task1: Migrate the current content on Gitbook to Readthedocs

Potential Tasks

[x] PR links to this issue would still happen in the community-handbook repository
[x] Might already be done by Sean:)  https://github.com/chaoss/community-handbook/pull/37
[x] May still need some supplementary revisions
[x] @ElizabethN Could you take a look at Sean's PR and merge it to the handbook repository?

I think this is already addressed.

repo: chaoss/community


text:
kubectl apply -f ./before not deploying

Hi,
I am working through the book Chaos Engineering and run into trouble with deploying the before state in chapter 6. When I run:
sudo kubectl apply -f ./before
I get the error:
error: error reading [./before]: recognized file extensions are [.json .yaml .yml]
I don't know if this is a change in kubernetes or I did not catch something to do. Was a bit frustrating to want to learn from the book and surprisingly finding myself having to setup a kubernetes cluster without basically any documentation.

if you are using k8, you need to run the following sudo kubectl appy -f ./before/k8s


text:
🛑 secret (Garuda) is down

In 45a0285, secret (Garuda) (https://secret-mirror.chaotic.cx/no-failover/chaotic-aur/lastupdate) was down:

HTTP code: 503
Response time: 158 ms

Resolved: secret (Garuda) is back up in f667554.

repo: chaotic-aur/chaotic-uptimes


text:
🛑 in-2 (Albony) is down

In bd70fa6, in-2 (Albony) (https://in-2-mirror.chaotic.cx/no-failover/chaotic-aur/lastupdate) was down:

HTTP code: 502
Response time: 676 ms

Resolved: in-2 (Albony) is back up in 387ee01.


text:
🛑 br (UFSCar Alcateia) is down

In c33cf49, br (UFSCar Alcateia) (https://br-mirror.chaotic.cx/no-failover/chaotic-aur/lastupdate) was down:

HTTP code: 503
Response time: 256 ms

Resolved: br (UFSCar Alcateia) is back up in c557a64.


text:
🛑 in (Naman) is down

In 30b3dd3, in (Naman) (https://in-mirror.garudalinux.org) was down:

HTTP code: 0
Response time: 0 ms

Resolved: in (Naman) is back up in f79a06e after 15 minutes.


text:
Pull from DockerHub instead of importing the image [do not merge]

This PR is to test whether travis passes without the conda packages and eliminates the need for a specific amazon S3 image.

@chapmanb, seems like pip-installing the repos directly from github would be a hassle because there's fortran code to compile in there:
https://travis-ci.org/brainstorm/bcbio-nextgen/builds/89748915
So I guess we'll have to do those changes and push a new conda release for bcbio and bcbio-vm?:
The thin PR should be safe to merge: https://github.com/chapmanb/bcbio-nextgen-vm/pull/134
@guillermo-carrasco

I was now looking into rebuilding the bcbio and bcbio-vm conda packages, but I cannot find them on the bioconda channel: https://github.com/chapmanb/bioconda-recipes
But I can find them over here:
https://conda.anaconda.org/bcbio
Can you shoot me some pointer(s) on how to rebuild those two? Thanks!

Roman -- sorry for the delay in merging and updating the conda repositories. These are not yet migrated over to bioconda. We're working on doing that slowly but have a lot of dependencies in bcbio-conda and homebrew that need migration work. It should now be up to date with your fixes to pull from Docker hub. Hope this works for you.

It worked, all green with the image from dockerhub:
https://travis-ci.org/brainstorm/bcbio-nextgen/builds/89979269
Thanks @chapmanb!

authors: brainstorm chapmanb

repo: chapmanb/bcbio-nextgen

license: mit


text:
Docs: Uppercase HTTP Authentication Header Bearer

Thanks a lot for this great project! I have stumbled upon this issue when I tried to copy paste the docs. The authentication would not work properly because Drupal expects 'bearer' to be 'bearer'

Ah nice catch. Thank you. Appreciate it. 🙌

repo: chapter-three/next-drupal


text:
When working on multiple databases, mutant is trying to alter schema in all databases.

I am using multiple databases and database router.  If I create a ModelDefinition or do anything which alter schema, the schema alteration is happening in all the databases instead of the current one.

Putting allow_migrate method in database router solved the issue.

repo: charettes/django-mutant


text:
regex fixed to match number >9

While testing the changes I tried to do I found a bug. If the numbers of changed (create, destroy, update) resources exceed 9 the regex will not find them causing the code to never even look for the end line.

For this to have been found it would be a good idea to add the warnings into the features to be tested, though that is a little over my ability.


text:
[Autofix error] UP036 autofix fails on complex nested block

UP036 transforms the following
import sys

if sys.version_info < (3, 8):

    def a():
        if b:
            print(1)
        elif c:
            print(2)
        return None

else:
    pass

to
import sys

if c:
            print(2)
        return None

else:
    pass

which is invalid syntax and also removed a lot of the code incompletely.
Command:
ruff --no-cache --select UP036 --fix code.py

ruff version fd16d658e9407ce76bc38cd8f5112dd272fc5be0

Removing code is intended (it's removing the outdated version check based on the currently-specified minimum version), but the output is clearly wrong.

I would like to work on this.

Thanks @JonathanPlasse.

authors: JonathanPlasse charliermarsh konstin

repo: charliermarsh/ruff


text:
fix: Insert comma to avoid possible missundertood.

When read without the comma, it gives me the impression that there are two tutorials covering the topic of commands.
(I instantly go back, thinking, "Wait, what did I miss? Where is the first one about commands?")
However, the intention is to clarify that this is the second tutorial in the series of Bubble Tea tutorials.

Wow, great call. Thank you!

authors: locnnil meowgorithm

repo: charmbracelet/bubbletea


text:
Running npm run dev overwrites test/index.js

Expected behavior
running npm run dev should not alter the files in the project
Current behavior
test/index.js gets overriten.
Reproducible sample
run npm run dev
Optional extra steps/info to reproduce
No response
Possible solution
No response
Context
No response
chart.js version
current master
Browser name and version
No response
Link to your project
No response

https://github.com/jlmakes/karma-rollup-preprocessor/issues/75

@LeeLenaleee FYI we had the same issue in chartjs-plugin-annotation and chartjs-adapter-luxon. We backed to previous version of preprocessor: npm i karma-rollup-preprocessor@7.0.7 --save-dev

authors: LeeLenaleee kurkle stockiNail


text:
Doughnut tooltips displayColors problem

After the upgrade to 2.7 I found a bug.
When the option displayColors: false is set the text color of tooltips are black.
I tryed to set the bodyFontColor: '#ffffff', etc but the color text on the tooltips are always black.
this is my code:
var myChart	 = new Chart(ctx, {
    type: 'doughnut',
    data: data<?php echo $grafico_key; ?>,
    options: {
        responsive: true,
        maintainAspectRatio: false,
        animation: {
            duration: 2000,
        },
        legend: {
            display: false
        },
        tooltips: {
            mode: 'label',
            position: 'nearest',
            xPadding: 10,
            yPadding: 10,
            bodyFontSize: 15,
            bodySpacing: 8,
            caretSize: 10, //freccetta
            displayColors: false,
            bodyFontColor: '#fff',
            callbacks: {
                label: function(tooltipItem, data) {
                    var valore = aggiungiPercento(data.datasets[0].data[tooltipItem.index].toString().trim());
                    return (data.labels[tooltipItem.index] + ": " + valore);
                },
                labelTextColor: function(tooltipItem, chart) {
                    return '#ffffff';
                }
            }
        }
    }
});

Edit (SB): code formatting

+1. Same problem here. :/

@officinainformatica @infodark can one of you build a jsfiddle that reproduce this issue?

Is the first time with jsfiddle but I try
https://jsfiddle.net/48so5r63/

You need to use https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.bundle.js for the fiddle to work.

Can reproduce this issue (fiddle), introduced by #4199.

This is a breaking change. We need to enable displayColors to make "tooltip" visible. I think this should be on documentation or update notes for 2.7.
I hope you can fix this on 2.7.1.

I'm happy to review a PR for fixing this if someone has it.

What is the roadmap to this fix? (Days, weeks, months) I'm still building for development, but in a couple of months it needs to go into production.

Thanks @etimberg I will stay standby for now then

Done in #4783

authors: EmilMoe etimberg infodark officinainformatica simonbrunel yusufozturk


text:
pointLabels (labels around the edge in a radar chart) could not be rotated

Is there any chance to rotate the pointLabels (labels around the edge in a radar chart)  ?
It will be good to have this option/property like rotation ?
rotation : [array]
array -> allows to have rotation (degree) pointLabels independently.
Currently Point Label has Options:
display
fontColor
fontFamily
fontSize
fontStyle
lineHeight

.


text:
Bar chart - Dataset Properties  vs Dataset Configuration

When browsing docs for bar chart, I have come across two distinct sub-sections:

Dataset Properties
Dataset Configuration

Both belong to datasets (as object properties) but why were they moved to separate sub-sections?

Looks like the first one can be specefied for each dataset and the other one are options for all datasets of that chart.

Looks like the first one can be specefied for each dataset and the other one are options for all datasets of that chart.

That makes sense but in the given example these properties are set for a specific data set:
data: {
    datasets: [{
        barPercentage: 0.5,
        barThickness: 6,
        maxBarThickness: 8,
        minBarLength: 2,
        data: [10, 20, 30, 40, 50, 60, 70]
    }]
};

That makes sense but in the given example these properties are set for a specific data set:
data: {
    datasets: [{
        barPercentage: 0.5,
        barThickness: 6,
        maxBarThickness: 8,
        minBarLength: 2,
        data: [10, 20, 30, 40, 50, 60, 70]
    }]
};

how to decrease space between bar when barThickness given value to 12?

how to decrease space between bar when barThickness given value to 12?

Circling back to this, I think both those sections can be merged together. I think the likely route is to remove the dataset configuration setting in favour of dataset properties.

authors: LeeLenaleee alexkuc etimberg febyolaaldo


text:
Bugfix/animation

animateResize
execute animateFrame if duration > 0 n animate is true

Thanks for the PR!
Can you please remove the spaces that were added? I.e. change function ( back to function(. The reason being that it's much harder to see what's changed when there's formatting changes mixed in, the extra spaces cause 219 eslint errors, and the formatting of this file is now inconsistent with the rest of the codebase.

@cybermerlin can you describe more precisely what issue you are trying to fix?
Unit tests are failing, you can run gulp unittest to figure out why and fix them. Note that your PR is incompatible with our coding standards, you will need to revert all styling changes you made (you can run gulp lint to verify).

hi, ok, I use gulp unittest n will fix errors later.
but function (  space fixed only through edit settings in my IDE, this is very bad

complete

You still have spaces in function ( resulting in 145 codeclimate errors

@cybermerlin can you update this PR to address the comments if you're still interested in merging this? or can you close the PR if you won't be updating it

authors: benmccann cybermerlin simonbrunel


text:
Some Feature for Kellan to build

Hand it over bro - I have the time :)

Going to be pushing up the code today :D

Well get me in der to help with something bro!  If not I will keep putting together a stock market analytics tool for 95% statistical significance in predicting price changes week-over-week.  Its something I was working on for my capsone a while back.

@GelLiNN We're currently implementing a web app to match volunteers up with people in need i.e. elderly need help with groceries, sick & need some over the counter meds, etc. Just to alleviate some of the pressure from other delivery apps. :D

authors: GelLiNN chasekaylee

repo: chasekaylee/LoveThyNeighbour-FE


text:
模型的输出和baichuan官方程序给的输出不一样

langchain-ChatGLM 版本：v0.2.3
我训练了一个baichuan-13B的qlora然后和主模型合并成新模型，但模型的输出和baichuan官方程序给的输出不一样，是否是因为输入的Template和baichuan官方的不一样？我该怎么改？
config中的内容我也已对应修改了：
LLM_MODEL = "baichuan-13b"
llm_model_dict = {
"baichuan-13b": {
"local_model_path": "./model_new_0926",
"api_base_url": "http://localhost:8888/v1",
"api_key": "EMPTY"
}
}

可以按照peft加载
如果你是merge成一个模型，你需要改一下你的template
并且，你需要确认fschat是否能支持读入你合并的模型

template

可以按照peft加载 如果你是merge成一个模型，你需要改一下你的template 并且，你需要确认fschat是否能支持读入你合并的模型

在哪修改template，有示例吗

要自己更改fastchat.model.model_adapter.py中的内容，我已经搞定，感谢!

请问一下如何修改，方便给个示例吗

repo: chatchat-space/Langchain-Chatchat


text:
[BUG] 添加知识库文件doc,docx文件失败

问题描述 / Problem Description
添加知识库文件doc,docx文件失败
复现问题的步骤 / Steps to Reproduce
添加doc，docx文件
预期的结果 / Expected Result
正常分割文件
实际结果 / Actual Result
文件正常上传未正常分割/读取
2024-02-27 22:32:20,629 - utils.py[line:298] - INFO: RapidOCRDocLoader used for C:\ai\Langchain-Chatchat\knowledge_base\test\content\jq1.doc
***fuckfuck55
RapidOCRDocLoader
C:\ai\Langchain-Chatchat\knowledge_base\test\content\jq1.doc
{}
***fuckfuck66
***fuckfuck1122
2024-02-27 22:32:21,007 - utils.py[line:394] - ERROR: PackageNotFoundError: 从文件 test/jq1.doc 加载文档时出错：Package not found at 'C:\ai\Langchain-Chatchat\knowledge_base\test\content\jq1.doc'

异常定位在utils.py的66打印下
def file2docs(self, refresh: bool = False):
        print("***fuckfuck33")
        if self.docs is None or refresh:
            print("***fuckfuck44")
            logger.info(f"{self.document_loader_name} used for {self.filepath}")
            print("***fuckfuck55")

            print(self.document_loader_name);
            print(self.filepath);
            print(self.loader_kwargs);

            loader = get_loader(loader_name=self.document_loader_name,
                                file_path=self.filepath,
                                loader_kwargs=self.loader_kwargs)
            print("***fuckfuck66")
            self.docs = loader.load()--------------------------------------->出错
            print("***fuckfuck77")
        return self.docs

环境信息 / Environment Information

langchain-ChatGLM 版本/commit 号：(例如：v2.0.1 或 commit 123456) / langchain-ChatGLM version/commit number: (e.g., v2.0.1 or commit 123456)
是否使用 Docker 部署（是/否）：否
使用的模型（ChatGLM2-6B / Qwen-7B 等）：ChatGLM3-6B
使用的 Embedding 模型（moka-ai/m3e-base 等）：moka-ai/m3e-base / Embedding model used (moka-ai/m3e-base, etc.): moka-ai/m3e-base
使用的向量库类型 (faiss / milvus / pg_vector 等)： faiss
操作系统及版本 / win11，anaconda
Python 版本 / 3.11
其他相关环境信息 / Other relevant environment information:

附加信息 / Additional Information
添加与问题相关的任何其他信息 / Add any other information related to the issue.
有大神可以给个解决方案吗

这个问题我也遇到了，doc解析失败，docx成功，排查了一下，PackageNotFoundError 应该指的是soffice依赖库没有安装造成的，运行 apt-get install libreoffice-writer 应该能解决问题，由于我用的是WSL2，没有继续尝试，遇到问题的可以试一试。

这个问题我也遇到了，doc解析失败，docx成功，排查了一下，PackageNotFoundError 应该指的是soffice依赖库没有安装造成的，运行 apt-get install libreoffice-writer 应该能解决问题，由于我用的是WSL2，没有继续尝试，遇到问题的可以试一试。

我也安装了libreoffice，不知道是什么原因，就是读doc报错，难道我是win11直接在anaconda上跑的？
我看到项目依赖的库是python-docx，但是我python-docx都是安装好的，没道理一个python项目读写doc文件需要用到跨系统的其他工具……
再等一个大神解我心头之惑

和你一样，win11直接运行anaconda,上传都没问题，就是不能向量doc,向量docx没问题。

您好，问题解决了吗

doc应该是langchian的问题，尝试回滚到之前的lc，不然也没办法的，这部分用的是lc

doc应该是langchian的问题，尝试回滚到之前的lc，不然也没办法的，这部分用的是lc

一直想问lc是啥

doc应该是langchian的问题，尝试回滚到之前的lc，不然也没办法的，这部分用的是lc

一直想问lc是啥

langchian的缩写。。

doc应该是langchian的问题，尝试回滚到之前的lc，不然也没办法的，这部分用的是lc

你好，这里建议的lc版本是多少呢？

您好，lc是他吗

authors: bycode murdonson pakchoily toasun yumu7777777 zRzRzRzRzRzRzR


text:
[BUG] 加载doc文档报错

问题描述 / Problem Description
具体报错信息如下：
2024-04-09 01:58:32,949 - utils.py[line:377] - ERROR: ValueError: 从文件 云网确认单/9－2023年云网中心经责审计-三重一大决策管理和制度管理不规范－饶姝涵.doc 加载文档时出错：file '/home/AuditKnowledgeBase/LangChain-ChatChat/knowledge_base/云网确认单/content/9－2023年云网中心经责审计-三重一大决策管理和制度管理不规范－饶姝涵.doc' is not a Word file, content type is 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'
2024-04-09 01:58:32,965 - kb_doc_api.py[line:397] - ERROR: 添加文件‘9－2023年云网中心经责审计-三重一大决策管理和制度管理不规范－饶姝涵.doc’到知识库‘云网确认单’时出错：从文件 云网确认单/9－2023年云网中心经责审计-三重一大决策管理和制度管理不规范－饶姝涵.doc 加载文档时出错：file '/home/AuditKnowledgeBase/LangChain-ChatChat/knowledge_base/云网确认单/content/9－2023年云网中心经责审计-三重一大决策管理和制度管理不规范－饶姝涵.doc' is not a Word file, content type is 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'。已跳过。
2024-04-09 01:58:32,968 - utils.py[line:377] - ERROR: ValueError: 从文件 云网确认单/16-2023年云网中心经责审计-部分行业专属云业务试用到期后未及时冻结资源或转商用－戴维.doc 加载文档时出错：file '/home/AuditKnowledgeBase/LangChain-ChatChat/knowledge_base/云网确认单/content/16-2023年云网中心经责审计-部分行业专属云业务试用到期后未及时冻结资源或转商用－戴维.doc' is not a Word file, content type is 'application/vnd.openxmlformats-officedocument.themeManager+xml'
2024-04-09 01:58:32,987 - kb_doc_api.py[line:397] - ERROR: 添加文件‘16-2023年云网中心经责审计-部分行业专属云业务试用到期后未及时冻结资源或转商用－戴维.doc’到知识库‘云网确认单’时出错：从文件 云网确认单/16-2023年云网中心经责审计-部分行业专属云业务试用到期后未及时冻结资源或转商用－戴维.doc 加载文档时出错：file '/home/AuditKnowledgeBase/LangChain-ChatChat/knowledge_base/云网确认单/content/16-2023年云网中心经责审计-部分行业专属云业务试用到期后未及时冻结资源或转商用－戴维.doc' is not a Word file, content type is 'application/vnd.openxmlformats-officedocument.themeManager+xml'。已跳过。
复现问题的步骤 / Steps to Reproduce
添加文档至向量库中
预期的结果 / Expected Result
描述应该出现的结果 / Describe the expected result.
实际结果 / Actual Result
描述实际发生的结果 / Describe the actual result.
环境信息 / Environment Information

langchain-ChatGLM 版本/commit 号：(例如：v2.0.1 或 commit 123456) / langchain-ChatGLM version/commit number: (e.g., v2.0.1 or commit 123456)
是否使用 Docker 部署（是/否）：是 / Is Docker deployment used (yes/no): yes
使用的模型（ChatGLM2-6B / Qwen-7B 等）：ChatGLM-6B / Model used (ChatGLM2-6B / Qwen-7B, etc.): ChatGLM2-6B
使用的 Embedding 模型（moka-ai/m3e-base 等）：moka-ai/m3e-base / Embedding model used (moka-ai/m3e-base, etc.): moka-ai/m3e-base
使用的向量库类型 (faiss / milvus / pg_vector 等)： faiss / Vector library used (faiss, milvus, pg_vector, etc.): faiss
操作系统及版本 / Operating system and version:ubuntu22.04
Python 版本 / Python version:3.11
其他相关环境信息 / Other relevant environment information:

附加信息 / Additional Information
添加与问题相关的任何其他信息 / Add any other information related to the issue.

要用docx

doc的文档没法适配是吧？

我针对document_loaders\mydocloader.py文件添加了将doc文件转换为docx文件，但是我是小白，不清楚加这个com环境会不会对整体产生什么后果或者负载。
...
import os
import tempfile
import win32com.client
import pythoncom
def conversion_function(doc_file_path: str) -> str:
# 初始化 COM 环境
pythoncom.CoInitialize()
# 创建 Word 应用程序对象
word = win32com.client.Dispatch('Word.Application')

# 打开.doc 文件
doc = word.Documents.Open(doc_file_path)

# 将文件保存为.docx 文件
docx_file_path = os.path.join(tempfile.mkdtemp(), "converted_docx.docx")
doc.SaveAs(docx_file_path, 16)  # 16 是.docx 文件格式

# 关闭 Word 应用程序
word.Quit()

# 释放 COM 环境
pythoncom.CoUninitialize()

return docx_file_path

class RapidOCRDocLoader(UnstructuredFileLoader):
def _get_elements(self) -> List:
def doc2text(filepath):
if filepath.endswith('.doc'):
filepath = conversion_function(filepath)
...

authors: china-gcg lvrui-code zRzRzRzRzRzRzR


text:
[BUG] webui能正常加载线上模型，api.py加载不了，会报错

Traceback (most recent call last):
File "/root/autodl-tmp/langchain-ChatGLM/api.py", line 590, in
api_start(args.host, args.port, ssl_keyfile=args.ssl_keyfile, ssl_certfile=args.ssl_certfile)
File "/root/autodl-tmp/langchain-ChatGLM/api.py", line 529, in api_start
llm_model_ins = shared.loaderLLM()
File "/root/autodl-tmp/langchain-ChatGLM/models/shared.py", line 39, in loaderLLM
loaderCheckPoint.reload_model()
File "/root/autodl-tmp/langchain-ChatGLM/models/loader/loader.py", line 506, in reload_model
self.model, self.tokenizer = self._load_model()
File "/root/autodl-tmp/langchain-ChatGLM/models/loader/loader.py", line 152, in _load_model
LoaderClass.from_pretrained(checkpoint,
File "/root/pyenv/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 461, in from_pretrained
config, kwargs = AutoConfig.from_pretrained(
File "/root/pyenv/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 983, in from_pretrained
config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
File "/root/pyenv/lib/python3.10/site-packages/transformers/configuration_utils.py", line 617, in get_config_dict
config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
File "/root/pyenv/lib/python3.10/site-packages/transformers/configuration_utils.py", line 672, in _get_config_dict
resolved_config_file = cached_file(
File "/root/pyenv/lib/python3.10/site-packages/transformers/utils/hub.py", line 452, in cached_file
raise EnvironmentError(
OSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like THUDM/chatglm-6b-int4 is not the path to a directory containing a file named config.json.
Checkout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.

挂梯子或者多试几次

代码已更新至0.2.0版本，重新设计了api，并基于api开展的webui开发。

authors: TCHSDUFH fhyu imClumsyPanda

repo: chatchat-space/langchain-ChatGLM


text:
Improve doc for Identity validation section

Hi :)
In your documentation, you describe how to add identifier_hash (https://www.chatwoot.com/docs/website-sdk#identity-validation) and how to generate it (https://www.chatwoot.com/docs/website-sdk/identity-validation). But not clear how it works. Maybe I missing something but should be a possibility to disable unsigned requests (without identifier_hash).
I added identifier_hash, but don't understand how it works and protects my setup.
If it possible could you extend a bit your documentation with an explanation of this moment? Thanks!

@KonstantinReido

When chatwoot script is added to a website, without identity verification. It leaves open the chance for a rogue user to impersonate another user.  They can call methods like window.setUser from their console with spoofed data.
With HMAC authentication, you are hashing your user identifier attribute with a unique key that you obtain from your chatwoot inbox settings. Since the attacker doesn't have access to this unique key they wouldn't be able to spoof the user identifiers required for the other users.
When you have HMAC enabled sessions, conversation history will be shared for the verified users across various browser sessions.  For the non-verified users, conversation history is limited to a particular browser session.

Internally we store user sessions in the contact_inboxes table. When ever it's a session identified using identifier hash, these records will have the attribute verified as true. In the upcoming releases we will have option to ignore unsigned conversations / a special indicator for verified conversations.

let me know if you have more questions. I will update the docs with the summary of this conversation

Hey, I have a follow-on question for this.  How does the customer receive and submit the identifier_hash as part of the web-request?  Is the idea that a customer might get an email link with the hash submitted as a URL parameter?
I'm thinking of integrating Chatwoot into a helpdesk ticketing system, and adding a link in support emails that would allow customers to launch a website live chat.  However, ticket emails can go to multiple users and/or be forwarded, so that might reveal the identifier_hash to others?
I've got a prototype javascript snippet that processes and uses the submitted identifier_hash but web development is not my thing and I feel like I'm doing it wrong...! :)  Any further help would be greatly appreciated.  Thanks!

closing in favor of https://github.com/chatwoot/docs/pull/402

authors: KonstantinReido cgb sojan-official

repo: chatwoot/docs


text:
UnknownObjectException for .exists? in find_watir_element

Hello.
I've updated from 1.2.0 to 1.2.1 and started getting errors when trying to call .exists? for any element when element is not yet on the page:
Watir::Exception::UnknownObjectException: unable to locate element,  using ...
(eval):1:in `find_watir_element'
./features/support/pages/vhols_complete_holiday_search_results_page.rb:112:in `page_load_element'

I can provide you more details (Gems versions, more code, etc) if you need this. Thanks in advance.

I've investigated a little bit.
In 1.2.0 I see the_call parameter of find_watir_element is 'element(identifier)'
and for 1.2.1 it's 'element(identifier).to_subtype'

@titusfortner this was from your pull request.  Any thoughts?

@z41 I'll look into it later today when I get home from work.

@z41 I've reproduced the error.  I'm on it this evening.

Cool :) thanks for quick feedback. For those who is looking for temporary solution, 2 possible ways:

specify version 1.2.0 in your Gemfile (but RubyMine can still try using a new version in this case. Try also to 'gem uninstall page-object-1.2.1' and invalidate caches / restart RubyMine if you're still facing problems)
monkey-patch the lib: override element_for  and elements_for methods to the old versions. I will not post this solution completely here as it's a bad practice. But if you're interested in it - please ping me.

@z41 I have pushed a fix and was wondering if you could possible give it a try to make sure it solves your problem.  I will be making a new release after I hear from you.

What is the reproduction for this issue?
I set ENV['DRIVER'] == 'WATIR' and ran the feature tests with 61fc34b and everything passes.

Or @cheezy do I need to do anything since it looks like your fix still lets everything pass all the tests?

@titusfortner:
write in page class something like:
element :missing, xpath: '//some-missing-xpath'
and then try using missing_element.exists? in your methods. You'll get an exception I've provided before.
@cheezy sorry for long time with no answer - it was a little bit tricky to use local gems with ruby mine :)
so, your fix works fine, thanks.
If you need further assistance (in case you want to fix this issues in another way and test it, etc) - just let me know.

I just released 1.2.2 that has this fix.

authors: cheezy titusfortner z41

repo: cheezy/page-object


text:
windows_certificates does nothing within Kitchen

Cookbook versions
4.3.2, 3.1.0
Chef-client version
14.2.0, 12.19.36
Platform Details
Windows 10 (latest patches)
Windows Server 2016 (latest patches)
Created from Packer via JacqInTheBox
Scenario:
I run Kitchen converge with the following recipe:
windows_certificate "#{node['Certificates']['location']}/certificate.pfx" do
  pfx_password '*****'
  store_name node['Certificates']['TrustedFolder']
  action :create
end

.kitchen.yml from my windows cookbook:
driver:
  name: vagrant
  customize:
    cpus: 2
    memory: 4096

transport:
  name: winrm
  elevated: true

provisioner:
  name: chef_zero
  deprecations_as_errors: true

verifier:
  name: inspec

platforms:
  - name: windows_10
    driver:
       box: windows_10
       provider: parallels
  - name: windows_server_2016
    driver:
       box: windows_server_2016
       provider: parallels

Notably: if I pass in the wrong password, the recipe fails to converge. But if the password is correct, the recipe appears to succeed but no certificate is pushed into the TRUSTEDFOLDER.
Steps to Reproduce:
kitchen create; kitchen converge;
The issue started sometime between Summer of 2017 and Spring of 2018. I've got several working cases on outside environments, but Kitchen can't install my certificates or the certificates located in the Windows cookbook source. Nothing appears in the mmc.exe when I load up the Certificates snap-in (this is true for both "My user account" and "Computer account").
The next level of debugging would be into the ruby gem of win32-certstore, but I'm not sure how I would go about doing that via Kitchen.
Expected Result:
I expect the certificate to be installed and configured correctly.
Actual Result:
No certificate is created.

@DanSibbernsen This is occurred due to we have validation for certificate-store. Now we update the code so if you open any store that not exist and want to add new certificate in that then our code will create new store for you and add new certificate in that. https://github.com/chef/win32-certstore/pull/36

This should be resolved in the latest version of the cookbook which uses and updated version of our win32-certstore gem. If you're still having this issue after updating the cookbook then please open this back up so we can dig in.

authors: DanSibbernsen piyushawasthi tas50

repo: chef-cookbooks/windows


text:
Custom properties not being read from kitchen.yml

Versions:

Version of kitchen-vra: 2.6.0
Version of test-kitchen: 1.16.0
Version of chef: 12.21.26

Platform Details

Version of vRA: 7.2
Version of ESXi: 6.5

Scenario:
Extra parameters are not being applied to the VM request when I run kitchen create. Not sure if it's relevant but I am specifying an alternate kitchen file by setting $env:KITCHEN_YAML. Test Kitchen is being executed from Powershell 5.1 on Windows 10.
Steps to Reproduce:
Here is the platform portion of my kitchen file in regards to setting the custom property values (generalized to remove company specific data but the structure is the same):
platforms:
  - name: platform-windows-2012r2
    driver:
      cpus: 2
      memory: 4096
      catalog_name: Windows2012R2
      subtenant_name: 'cloud_dev'
      extra_parameters:
        provider-My.Property.Name:
          type: string
          value: 'Some value goes here'

There are about 15 properties i'm setting in this way under extra_parameters. It is also unclear whether machine properties need to be nested specially as well.
Expected Result:
All custom properties I am passing in are recognized.
Actual Result:
For required properties, the request fails with the error "The data specified within the request is invalid., Field with id My.Property.Name is required." In reality the error is extended with every required property that is not being picked up from my kitchen file.

Seeing the same issue, not sure if it is kitchen-vra or vmware-vra gem that is the issue.

It's been a while since I looked at this, I think vmware-vra gem changed and kitchen-vra needs to be updated. But then I got pulled into some other stuff and haven't been able to work on a fix yet.

I am testing on the following:
Test Kitchen version 1.24.0
kitchen-vra (2.6.0)
vmware-vra (2.6.1)

Also seeing this right now, on:
kitchen-vra 2.6.0
vmware-vra (2.6.1, 2.3.0, 1.5.2)

Platform: Windows
vmware vRealize Automation 7.0.1

These props are not being set:
cpus: 2
memory: 8192
lease_days: 7
notes: 'a note'
description: 'a description'

I'm hoping my plate clears in the next couple weeks and I can look into this again, but it would be nice if someone from chef-partners could weigh in.

We have been researching a similar issue in https://github.com/chef-partners/kitchen-vra/issues/33
I note the extra_parameters appears to be a tilde-delimited field, rather than a hyphen as per the OP - maybe the combination of the workaround in #33 and using the tilde would solve the problem here. Please let us know any feedback you have which would help us, we do not have easy access to all the specific VRA versions being mentioned here.

I should at least be able to give this another go later this week, if not, next week, if a potential workaround has been identified.

Actually now that I read #33 I'm fairly certain I had run into the ~ issue when I was trying to solve this on my own, and did fix it by to_sing at the split_key line, but still found that the extra parameters were not getting supplied with the request. However, I'll give this a shot again when I get some time in case I'm mistaken, it's been several months since I worked on this.

This should be fixed by the release that was just made to the vmware-vra gem (2.7.0) - as kitchen-vra pins to any 2.0 release you should be able to update your chef/ruby installation using chef gem install vmware-vra.  The kitchen-vra gem has not been modified.
Please note the provider- prefix on the parameter name should not be required and you should see all parameters included nested parameters in the inputs when you deploy a Blueprint.

Sweet! I'll try to give this a go soon.

authors: PopPopDevOps bender-the-greatest mcascone stuartpreston

repo: chef-partners/kitchen-vra


text:
knife vsphere vm clone with VDS

Hello Folks,
I do not know if missing parameters something, but the clone with a VDS is not working, the clone is completed anyway and no errors in vmware event, however they portgroup is not present in VM.
knife vsphere vm clone habari-1 --template Template-Centos66 -f Templates -d DC --resource-pool QA --bootstrap true --distro chef-full --cdnsips 172.16.27.131 --cdnssuffix lab.local.io --cdomain lab.local.io --cvlan 1234 --cgw 172.16.170.1 --cips 172.16.170.21/23 --ssh-user root --ssh-password 'q1w2e3r4t5' -N nhabari-1.lab.local.io --dest-folder 'Tools' -E QA -r 'role[base-centos]' --ccpu 2 --cram 2 --config /opt/spec.chef/knife-qa.rb
How do I fix this?
thx,
Hernani

Hi Hernani,
Does your template have the network interface already created? In the clone phase, I don't believe we create any NICs; we just assign IPs to the ones from the template.

Hello,
Yep, the template have NIC in vss "VM Network" and when make the clone changed the portgroup to vds.
thank's for yout time :).

Any chance you can include some screenshots? I guess I'm not clear on what's going on.

Okay, i try again. In my template we've one NIC and it has associated an stantard vswitch is my default. however when deployed new VM's with this template.

Agian with network detail :).

And when clone finished.

This is esxi log when deploy the template
hostd.log:2015-09-16T13:43:54.862Z [46381B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] sleepState value is 0
hostd.log:2015-09-16T13:43:54.862Z [46381B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] MKS ready for connections: true
hostd.log:2015-09-16T13:43:54.862Z [46381B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Version status of tools changed to: 1
hostd.log:2015-09-16T13:43:54.863Z [46381B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Tools version changed to: 9216
hostd.log:2015-09-16T13:43:54.941Z [46381B90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Unable to get network object for network 1227
hostd.log:2015-09-16T13:43:54.960Z [46381B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Time to gather config: 87 (msecs)
hostd.log:2015-09-16T13:43:55.103Z [46381B90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Unable to get network object for network 1227
hostd.log:2015-09-16T13:43:55.139Z [46381B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Time to gather config: 79 (msecs)
hostd.log:2015-09-16T13:43:55.260Z [46381B90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Unable to get network object for network 1227
hostd.log:2015-09-16T13:43:55.303Z [46381B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Time to gather config: 95 (msecs)
hostd.log:2015-09-16T13:43:55.359Z [46381B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Imgcust event values read from vmdb tree are state = 1, errorCode = 0, errorMsgSize = 0
hostd.log:2015-09-16T13:43:55.361Z [46381B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Running status of tools changed to: 0
hostd.log:2015-09-16T13:43:55.477Z [467C0B90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Unable to get network object for network 1227
hostd.log:2015-09-16T13:43:55.494Z [467C0B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Time to gather config: 42 (msecs)
hostd.log:2015-09-16T13:43:55.710Z [46444B90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Unable to get network object for network 1227
hostd.log:2015-09-16T13:43:55.726Z [46444B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Time to gather config: 49 (msecs)
hostd.log:2015-09-16T13:44:01.826Z [4A681B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Actual VM overhead: 40062976 bytes
hostd.log:2015-09-16T13:44:15.345Z [4A703B90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Unable to get network object for network 1227
hostd.log:2015-09-16T13:44:15.360Z [4A703B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Time to gather config: 36 (msecs)
hostd.log:2015-09-16T13:44:45.343Z [499C1B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Tools guest daemon status changed to: 1
hostd.log:2015-09-16T13:44:45.344Z [499C1B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] guest operations are ready
hostd.log:2015-09-16T13:44:45.344Z [499C1B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] CheckHeartbeatMonitor: Reviving the heartbeat monitor in 30 seconds
hostd.log:2015-09-16T13:44:45.367Z [46403B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Imgcust event values read from vmdb tree are state = 2, errorCode = 0, errorMsgSize = 0
hostd.log:2015-09-16T13:44:45.370Z [50580B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Tools are auto-upgrade capable
hostd.log:2015-09-16T13:44:45.371Z [46340B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Tools are operations ready
hostd.log:2015-09-16T13:44:45.734Z [45F81B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Skipped tools ManifestInfo update.
hostd.log:2015-09-16T13:44:45.734Z [45F81B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Version status of tools changed to: 1
hostd.log:2015-09-16T13:44:45.774Z [45F81B90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Unable to get network object for network 1227
hostd.log:2015-09-16T13:44:45.791Z [45F81B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Time to gather config: 45 (msecs)
hostd.log:2015-09-16T13:44:45.816Z [45F81B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Imgcust event values read from vmdb tree are state = 4, errorCode = 0, errorMsgSize = 38
hostd.log:2015-09-16T13:44:45.817Z [45F81B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Message: /var/log/vmware-imc/toolsDeployPkg.log
hostd.log:2015-09-16T13:44:45.817Z [45F81B90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Failed to find activation record, event user unknown.

hostd.log:2015-09-16T13:45:02.802Z [46444B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Message: /var/log/vmware-imc/toolsDeployPkg.log@4000
hostd.log:2015-09-16T13:45:02.802Z [46444B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] 4000
hostd.log:2015-09-16T13:45:02.803Z [46444B90 info 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Enabling NICs following customization: (vim.vm.ConfigSpec) {
hostd.log:2015-09-16T13:45:02.810Z [46444B90 info 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] State Transition (VM_STATE_ON -> VM_STATE_RECONFIGURING)
hostd.log:2015-09-16T13:45:02.810Z [46444B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Invoking interceptor:1-hbr
hostd.log:2015-09-16T13:45:02.810Z [46444B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Done invoking interceptor:1-hbr
hostd.log:2015-09-16T13:45:02.961Z [46444B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Current VM Tracking state: disabled
hostd.log:2015-09-16T13:45:02.993Z [46444B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Setting VM's tracking state to disabled.
hostd.log:2015-09-16T13:45:05.858Z [46598B90 info 'vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx']  Disconnect check in progress.
hostd.log:2015-09-16T13:45:05.858Z [4677FB90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Retrieved current VM state from foundry 4, 8
hostd.log:2015-09-16T13:45:05.858Z [4677FB90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Received a duplicate transition from foundry: 8, 1
hostd.log:2015-09-16T13:45:05.868Z [46444B90 info 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] State Transition (VM_STATE_RECONFIGURING -> VM_STATE_ON)
hostd.log:2015-09-16T13:45:05.893Z [46444B90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Unable to get network object for network 1227
hostd.log:2015-09-16T13:45:05.919Z [46444B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Time to gather config: 48 (msecs)
hostd.log:2015-09-16T13:45:05.943Z [46444B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Handling message _vmx4: Failed to connect virtual device Ethernet0.
hostd.log:2015-09-16T13:45:05.944Z [46444B90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Failed to find activation record, event user unknown.
hostd.log:2015-09-16T13:45:05.945Z [46444B90 info 'Vimsvc.ha-eventmgr'] Event 56807 : Error message on habari-1 on dc1-z1-h10 in ha-datacenter: Failed to connect virtual device Ethernet0.
hostd.log:2015-09-16T13:45:05.952Z [46598B90 info 'vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx']  Disconnect check in progress.
hostd.log:2015-09-16T13:45:05.954Z [FFC99D20 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Retrieved current VM state from foundry 4, 8
hostd.log:2015-09-16T13:45:06.013Z [46444B90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Unable to get network object for network 1227
hostd.log:2015-09-16T13:45:06.033Z [46444B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Time to gather config: 64 (msecs)
hostd.log:2015-09-16T13:45:06.094Z [46444B90 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Unable to get network object for network 1227
hostd.log:2015-09-16T13:45:06.112Z [46444B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Time to gather config: 43 (msecs)
hostd.log:2015-09-16T13:45:06.128Z [53080B90 info 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Answered question _vmx4
hostd.log:2015-09-16T13:45:06.129Z [FFC99D20 warning 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Received a duplicate transition from foundry: 8, 1
hostd.log:2015-09-16T13:45:09.976Z [4A640B90 verbose 'Vmsvc.vm:/vmfs/volumes/1e9373ca-19e65007/habari-1/habari-1.vmx'] Imgcust event values read from vmdb tree are state = 4, errorCode = 103, errorMsgSize = 43

Hmmm.  "Unable to get network object for network 1227" appears a bit. Wondering if we're looking for a distributed switch?

Yes, we've two type the switches in vmware, "virtual standard switch" vss (VM Network) and "virtual distributed switch" vds (1227).

Can you try your template starting off as a distributed switch please?

knife vsphere vm clone -VV habari-2 --template Template-Centos66 -f Templates -d DC --resource-pool QA --bootstrap true --distro chef-full --cdnsips 172.16.27.131 --cdnssuffix lab.local.io --cdomain lab.local.io --cvlan 1227 --cgw 172.16.170.1 --cips 172.16.170.22/23 --ssh-user root --ssh-password 'q1w2e3r4t5' -N habari-2.lab.local.io --dest-folder 'Templates' -E QA -r 'role[base-centos]' --ccpu 2 --cram 2
DEBUG: value for config item bootstrap: true
DEBUG: value for config item distro: chef-full
DEBUG: value for config item vsphere_host: vc.loca.io
DEBUG: value for config item vshere_path:
DEBUG: value for config item vsphere_port: 443
DEBUG: value for config item vsphere_nossl:
DEBUG: value for config item vsphere_user: habombo@loca.io
DEBUG: value for config item vsphere_pass: MAni113912
DEBUG: value for config item vsphere_insecure: true
DEBUG: value for config item proxy_host:
DEBUG: value for config item proxy_port:
DEBUG: value for config item vsphere_dc: DC
DEBUG: value for config item folder: Templates
DEBUG: value for config item vsphere_dc: DC
DEBUG: value for config item linked_clone:
DEBUG: value for config item resource_pool: QA
DEBUG: value for config item resource_pool: QA
DEBUG: value for config item vsphere_dc: DC
DEBUG: value for config item linked_clone:
DEBUG: value for config item datastore:
DEBUG: value for config item annotation:
DEBUG: value for config item customization_cpucount: 2
DEBUG: value for config item customization_cpucount: 2
DEBUG: value for config item customization_memory: 2
DEBUG: value for config item customization_memory: 2
DEBUG: value for config item customization_vlan: 1227
DEBUG: value for config item customization_vlan: 1227
DEBUG: value for config item vsphere_dc: DC
/Library/Ruby/Gems/2.0.0/gems/knife-vsphere-0.9.9/lib/chef/knife/vsphere_vm_clone.rb:337:in rescue in generate_clone_spec': undefined method deviceName=' for #RbVmomi::VIM::VirtualEthernetCardDistributedVirtualPortBackingInfo:0x007fc2c3e138a8 (NoMethodError)
from /Library/Ruby/Gems/2.0.0/gems/knife-vsphere-0.9.9/lib/chef/knife/vsphere_vm_clone.rb:332:in generate_clone_spec' 	from /Library/Ruby/Gems/2.0.0/gems/knife-vsphere-0.9.9/lib/chef/knife/vsphere_vm_clone.rb:231:in run'
from /Library/Ruby/Gems/2.0.0/gems/chef-11.14.6/lib/chef/knife.rb:493:in run_with_pretty_exceptions' 	from /Library/Ruby/Gems/2.0.0/gems/chef-11.14.6/lib/chef/knife.rb:174:in run'
from /Library/Ruby/Gems/2.0.0/gems/chef-11.14.6/lib/chef/application/knife.rb:139:in run' 	from /Library/Ruby/Gems/2.0.0/gems/chef-11.14.6/bin/knife:25:in <top (required)>'
from /usr/bin/knife:23:in load' 	from /usr/bin/knife:23:in '

Oh, you seem to be running a really old version of this gem, can you update please? gem install knife-vsphere

Mr. swalberg
Oh! Past update for last version any clone is working! However VDS on template is required.
Thank's for your time, i appreciate so much your help.
knife vsphere vm clone -VV habari-2 --template Template-Centos66 -f Templates -d DC --resource-pool QA --bootstrap true --distro chef-full --cdnsips 172.16.27.131 --cdnssuffix lab.local.io --cdomain lab.local.io --cvlan 1227 --cgw 172.16.170.1 --cips 172.16.170.22/23 --ssh-user root --ssh-password 'q1w2e3r4t5' -N habari-2.lab.local.io --dest-folder 'Templates' -r 'role[base-centos]' --ccpu 2 --cram 2
DEBUG: value for config item chef_node_name: habari-2.lab.local.io
DEBUG: value for config item vsphere_host: vc.local.io
DEBUG: value for config item vsphere_path: /sdk
DEBUG: value for config item vsphere_port: 443
DEBUG: value for config item vsphere_nossl:
DEBUG: value for config item vsphere_user: habombo@local.io
DEBUG: value for config item vsphere_pass: dfdfd12323@#
DEBUG: value for config item vsphere_insecure: true
DEBUG: value for config item proxy_host:
DEBUG: value for config item proxy_port:
DEBUG: value for config item vsphere_dc: DC
DEBUG: value for config item folder: Templates
DEBUG: value for config item vsphere_dc: DC
DEBUG: value for config item linked_clone:
DEBUG: value for config item resource_pool: QA
DEBUG: value for config item resource_pool: QA
DEBUG: value for config item vsphere_dc: DC
DEBUG: value for config item linked_clone:
DEBUG: value for config item datastore:
DEBUG: value for config item datastore:
DEBUG: value for config item datastorecluster:
DEBUG: value for config item thin_provision:
DEBUG: value for config item mark_as_template:
DEBUG: value for config item annotation:
DEBUG: value for config item customization_cpucount: 2
DEBUG: value for config item customization_cpucount: 2
DEBUG: value for config item customization_memory: 2
DEBUG: value for config item customization_memory: 2
DEBUG: value for config item customization_vlan: 1227
DEBUG: value for config item customization_vlan: 1227
DEBUG: value for config item vsphere_dc: DC
DEBUG: value for config item customization_spec:
DEBUG: value for config item customization_dns_ips: 172.16.27.131
DEBUG: value for config item customization_dns_ips: 172.16.27.131
DEBUG: value for config item customization_dns_suffixes: lab.local.io
DEBUG: value for config item customization_dns_suffixes: lab.local.io
DEBUG: value for config item customization_gw: 172.16.170.1
DEBUG: value for config item customization_gw: 172.16.170.1
DEBUG: value for config item disable_customization:
DEBUG: value for config item customization_domain: lab.local.io
DEBUG: Identified os as linux.
DEBUG: value for config item customization_domain: lab.local.io
DEBUG: value for config item customization_domain: lab.local.io
DEBUG: value for config item customization_plugin:
DEBUG: value for config item vsphere_dc: DC
Cloning template Template-Centos66 to new VM habari-2
Finished creating virtual machine habari-2
DEBUG: value for config item customization_plugin:
DEBUG: value for config item mark_as_template:
DEBUG: value for config item power:
DEBUG: value for config item bootstrap: true
Powered on virtual machine habari-2
DEBUG: value for config item bootstrap: true
DEBUG: Connect Host for Bootstrap: 172.16.170.22
DEBUG: value for config item ssh_port: 22
DEBUG: value for config item bootstrap_protocol:
Hernani

Thanks for the confirmation on the type of switch. Glad to hear you're up and running! Check back frequently at https://rubygems.org/gems/knife-vsphere, as we release updates as new stuff and bugfixes come in.

authors: hbombonato swalberg

repo: chef-partners/knife-vsphere


text:
[infra-proxy-service] Get the list of policy groups

User Story
we need to show the list of associated policy groups for the specific policy file.
policy groups response like
{
  "policy-group2": {
    "uri": "https://ec2-34-219-25-251.us-west-2.compute.amazonaws.com/organizations/4thcoffee/policy_groups/policy-group2",
    "policies": {
      "new-policy": {
        "revision_id": "7ebf0706e4a9ee7a9600c8fdca9f8c6d94d5e60ab0c16309bd710a57c5691acc"
      }
    }
  },
  "test": {
    "uri": "https://ec2-34-219-25-251.us-west-2.compute.amazonaws.com/organizations/4thcoffee/policy_groups/test",
    "policies": {
      "test": {
        "revision_id": "7730dd9420ccdbcf43a13ebd050621ed4e2cfc97ca12671b8b5181d30cd9038f"
      }
    }
  },
  "Policyfile.lock.json": {
    "uri": "https://ec2-34-219-25-251.us-west-2.compute.amazonaws.com/organizations/4thcoffee/policy_groups/Policyfile.lock.json",
    "policies": {
      "test": {
        "revision_id": "7730dd9420ccdbcf43a13ebd050621ed4e2cfc97ca12671b8b5181d30cd9038f"
      }
    }
  },
  "policy-group1": {
    "uri": "https://ec2-34-219-25-251.us-west-2.compute.amazonaws.com/organizations/4thcoffee/policy_groups/policy-group1",
    "policies": {
      "policy1": {
        "revision_id": "2e8d7fc8e9468c45888791d85290b1bb660b26209cccaa8bf7b52c7c8151125e"
      }
    }
  }
}

## Screenshots

We are using policy list API for the same purpose. So this is no longer required. @vinay033

repo: chef/automate


text:
Removing duplicate requests

:nut_and_bolt: Description: What code changed, and why?
Removing duplicate API requests from the policy and team pages. When loading the pages the observable subscribe functions were being called multiple times for with the same data. This caused the page's data to be requested each time.
:chains: Related Resources
#2104
:+1: Definition of Done
All of the auth pages do not perform multiple requests for page data.
:athletic_shoe: How to Build and Test the Change

build components/automate-ui && start_all_services
Open the Teams detail page for the admin https://a2-dev.test/settings/teams/admins
Open the Chrome inspect tool then select the network tab.
Ensure each API request is only called once.
Do the same thing for the team add user page, policy details page, and policy add member page.

:white_check_mark: Checklist

[x] Tests added/updated?
[ ] Docs added/updated?

:camera: Screenshots, if applicable

@msorens Thank you for the thorough review. Nice catch on the bug. I updated the code with all
but one of your suggestions. I did not feel comfortable pulling out the this.loading$ variable because I had some confusion on when the page is loaded.


text:
Update cookbook generate to generate proper Chefspec

We should generate Chefspec with a platform and platform version. Defaulting to ubuntu 16.04 would be a sane default probably

Fixed by https://github.com/chef/chef-dk/pull/1202

repo: chef/chef-dk


text:
Bump DK to 2.7 and add release notes

Signed-off-by: Tim Smith tsmith@chef.io

Doesn't build. This isn't going to get released at this point


text:
Add Ruby 3.1 testing to all dep repos

We need to ensure that we're running tests on Ruby 3.1 for all the deps we own which are used by chef:

http://github.com/chef/appbundler
http://github.com/chef/chef-telemetry
http://github.com/chef/chef-vault
http://github.com/chef/chef-zero
http://github.com/chef/cheffish
http://github.com/chef/corefoundation
http://github.com/chef/ffi-libarchive
http://github.com/chef/ffi-yajl
http://github.com/chef/license-acceptance
http://github.com/chef/mixlib-archive
http://github.com/chef/mixlib-authentication
http://github.com/chef/mixlib-cli
http://github.com/chef/mixlib-config
http://github.com/chef/mixlib-log
http://github.com/chef/mixlib-shellout
http://github.com/chef/ohai
http://github.com/chef/win32-certstore
http://github.com/chef/win32-event
http://github.com/chef/win32-ipc
http://github.com/chef/win32-mmap
http://github.com/chef/win32-mutex
http://github.com/chef/win32-process
http://github.com/chef/win32-service
http://github.com/chef/win32-taskscheduler
http://github.com/inspec/inspec
http://github.com/inspec/train
http://github.com/inspec/train-winrm
https://github.com/chef/wmi-lite
https://github.com/WinRb/rubyntlm
https://github.com/WinRb/winrm
https://github.com/WinRb/winrm-elevated
https://github.com/WinRb/winrm-fs

Moved to https://chefio.atlassian.net/browse/INFC-25

repo: chef/chef


text:
Knife user creation doesn't work in Chef 12

knife user create foo --admin -p xxxxxxxxxxxxxxxx

Opens an editor with the following:
{
  "name": "foo",
  "public_key": null,
  "admin": true,
  "password": "xxxxxxxxxxxxxxxx"
}

Saving gives this error:
ERROR: The data in your request was invalid
Response: Field 'username' missing

Changing name to username then saving results in the same error.

Same here. I also tried setting "name" and "username"...

Does this work for any version of Chef 12? That is, did 12.0.3 work, or just 11.x.x?

The short answer: You probably want to either (1) use chef-server-ctl user-create or (2) temporarily configure your knife client to such that the chef_server_url is the root of the chef server (no "organization/ORGNAME" in the URL) and the client is pivotal.
In Chef 11 Server: This command should work as expected.
In Chef 12 Server: Whether knife user create will work depends on the user making the request and the chef_server_url.  Chef 12 has the following user endpoints that expect POST:

POST /users:

This endpoint creates a new user.  With chef_server_url set to the root of your Chef server, and using the pivotal user, this command should work without modification.

POST /organizations/ORGNAME/users:

This endpoint force-associates an existing user with an organization (without the user accepting the invite).  This only works for the pivotal user.  The expected POST body is:
{ "username": "USERNAME" }

knife user create does not post the raw JSON that you enter into the editor.  Rather, it uses it to construct a valid Chef::User object where the name field is "name" and not "username".  In fact, it looks like it will probably ignore the username field altogether and will always pass the "name" field which isn't accepted by the organization-specific version of this endpoint.

This also doesn't work.  Then error morphs to "Field 'display name' missing.

I can't see how this isn't a bug, somewhere, from many perspectives, regardless of the choice of fix path. Could someone with privs add the bug label to this issue, please?

@jblaine I doubt anyone disagrees with you.  I don't think the bug vs feature tags are used very reliably at the moment.
@dcws Apologies on missing the display name issue.  On Chef 12 likely the only way to create a user right now is the user-create command.  Even when knife is fixed, you'll still need the super-user key to create users, which the user-create command uses underneath.
I'll assign this to myself to fix.

I'm also having the same problem.  Upgraded from chef 11 to chef 12.  I was working on process to backup our open source chef server and restore it to another server.  Everything is working except the users.  If i do a knife user show USERNAME.   It will not show the name of the user and if the user is an administrator the tag "admin:      false" is always returned.  It's never true.  This is causing a problem with the knife-backup gem.  The backing up of the users is not working as expected.

Just upgraded to ChefDK 0.6.0 hoping that it might somehow, magically, have been resolved, but it's still an issue - even trying to change the server URL (display_name field missing error instead of username).

I'm also getting this one:  "If i do a knife user show USERNAME. It will not show the name of the user and if the user is an administrator the tag "admin: false" is always returned. It's never true."

+1 This is a blocker for me as I can't find any workaround.
chef --version
Chef Development Kit Version: 0.5.1
chef-client version: 12.3.0
berks version: 3.2.3
kitchen version: 1.4.0

@spuder This is being worked on here: https://github.com/chef/chef/pull/3438
However, if you are on chef-server 12, then you should be able to create users with chef-server-ctl user-create.  Is that not working for you?

Yes, running chef-server-ctl user-create on the server appears to be a valid workaround.

Fix to knife user for Chef 12 is coming in this PR: https://github.com/chef/chef/pull/3438
However, only the superuser has permission to create new users in Chef 12 (there is no concept of global admins in Chef 12 like there was in Open Source Chef 11), so chef-server-ctl is probably still going be the easiest way to create new users (at least for now), but once this fix is shipped, if you set up a knife config for the superuser, you can use knife user to create new users via knife (see /etc/opscode/pivotal.rb on a Chef 12 Server for an example of this, or just use chef-server-ctl for now).
Again, chef-server-ctl user create is gonna be your best option, at least until we make user creation permissions more configurable, but this branch should make things less confusing and actually works with Chef 12.
Hope this helps :)

@tylercloke The entire reason to have knife user, IMO, is to allow individual org admins to create additional users within the org. Using the superuser is indeed redundant, and doesn't address this.

@luckymike Its a matter of permissions currently. User objects are global to the server, and are not specifically scoped to organizations, so by default, only the superuser has create access on Users, since "admins" are now scoped to orgs in CS12. However, as stated above, I agree knife user isn't that valuable against CS12 without more flexibility around User creation permissions. User creation and management is something I'm thinking about and would love to make easier for everyone :) I'll write up an RFC on how I think we could make User management and permissions better when I get a chance.
At least now, you will get a relevant error message about permissions instead of code that is completely broken against CS12, and is a base for future improvement.

An Org admin has permissions to create Org users via the $$ console, correct? If so, this doesn't seem like a permissions issue, so much as exposing the correct, existing permissions.

Org admins cannot create users in Enterprise Chef / Chef Server 12. Only the superuser can in those versions of the server. Org admins can simply add and remove existing users from their org, but that all that does is restrict or grant user access to the org itself. It does not affect existence of the user as a whole.

Ah, I see. Thanks for the clarification.

Fixed for newer versions of Chef Server 12 via this branch https://github.com/chef/chef/pull/3438 but still have to use the superuser. I recommend just using chef-server-ctl user-create for now to create new users in Chef Server 12. A few of us are thinking through an RFC to make user creation much less painful going forward and this is the first step on that path :)

authors: btm dcws jblaine joerg joerocklin luckymike sdarwin spuder stephenwrightii stevendanna tylercloke


text:
Add aarch64 builder-testers to map

Description
The aarch64 builders/testers were missing in the pipeline construction. Added those using the earlier release.omnibus.yml mapping as reference.

[x] Ad hoc build based on aarch64 includes the relevant builders/ testers & passes

Related Issue
aarch64 packages aren't getting built for Chef Infra Client when the new chef-foundation based pipeline runs.
Types of changes

[ ] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[x] Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

[x] I have read the CONTRIBUTING document.
[ ] I have run the pre-merge tests locally and they pass.
[ ] I have updated the documentation accordingly.
[ ] I have added tests to cover my changes.
[ ] All new and existing tests passed.
[x] All commits have been signed-off for the Developer Certificate of Origin.

I believe this is the same as this pr: https://github.com/chef/chef/pull/13657

yes, closing this one.

authors: sean-simmons-progress vkarve-chef


text:
just return if the event_list is empty when calling process_events_until_done

In the case where the event_list is empty, it errors out and gets this stack trace:
sh-4.2$ sudo cat /var/chef/.chef/local-mode-cache/cache/chef-stacktrace.out
Generated at 2019-08-16 15:12:23 +0000
ArgumentError: wrong number of arguments (given 0, expected 1+)
/opt/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.2.20/lib/chef/event_dispatch/dispatcher.rb:59:in `call_subscribers'
/opt/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.2.20/lib/chef/event_dispatch/dispatcher.rb:84:in `process_events_until_done'
/opt/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.2.20/lib/chef/event_dispatch/dispatcher.rb:31:in `enqueue'
(eval):2:in `updated_cookbook_file'
/opt/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.2.20/lib/chef/cookbook/synchronizer.rb:290:in `sync_file'
/opt/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.2.20/lib/chef/cookbook/synchronizer.rb:176:in `block (2 levels) in sync_cookbooks'
/opt/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.2.20/lib/chef/util/threaded_job_queue.rb:52:in `block (3 levels) in process'
/opt/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.2.20/lib/chef/util/threaded_job_queue.rb:50:in `loop'
/opt/chef/embedded/lib/ruby/gems/2.6.0/gems/chef-15.2.20/lib/chef/util/threaded_job_queue.rb:50:in `block (2 levels) in process'

Description
return sentinel clause to not do anything if the event_list is empty when process_events_until_done is invoked
Related Issue
https://github.com/chef/chef/issues/8825
Types of changes

[x] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[ ] Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

[x] I have read the CONTRIBUTING document.
[x] I have run the pre-merge tests locally and they pass.
[ ] I have updated the documentation accordingly.
[ ] I have added tests to cover my changes.
[x] All new and existing tests passed.
[x] All commits have been signed-off for the Developer Certificate of Origin.

@komealy It looks like you might have run rubocop or cookstyle on this PR based on the quote change at the top. Can you run Chefstyle on this file to make sure the style matches our style guide?

Upon further inspection, it looks like this sentinel clause actually should be looking at the element itself, and not the list. Before we move forward, I'll want to add another commit with some unit tests includes as well.

@tas50 I ran chefstyle and even added in the rules that it was enforcing into the rubocop.yml so my auto-format option in VSCode doesn't break me 😁
I also changed my sentinel clause to handle another scenario that I found. It needs to skip not just the first one, but any events that are actually nil.

Didn't mean to close it, the close and comment button is too close to Comment 🤦♂

@jaywhy13  I have not found a workaround other than this fix. My particular situation only happens once, then when I just try again, it works...

This is almost certainly a race condition caused by multithreaded access from the cookbook synchronizer to the queueing functions.  This is probably not the correct fix.

Looks like the proper fix is in #8950

authors: komealy lamont-granquist tas50


text:
[chef-utils] fix typos

Signed-off-by: Michel Salim michel@fb.com
Description
Slightly reword the introduction paragraph, and fix the mention of Devuan (the systemd-less Debian derivative).
Related Issue
N/A
Types of changes

[ ] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
[x] Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

[x] I have read the CONTRIBUTING document.
[ ] I have run the pre-merge tests locally and they pass.
[x] I have updated the documentation accordingly.
[ ] I have added tests to cover my changes.
[ ] All new and existing tests passed.
[x] All commits have been signed-off for the Developer Certificate of Origin.

This change is

Thanks @michel-slm


text:
Rspec 3 fixes

Fixes RSpec 3 incompatibilities. See also https://github.com/chef/chef-pedant/pull/95
@chef/server-team

:+1:

authors: danielsdeleo tylercloke

repo: chef/oc-chef-pedant


text:
Switch travis to sqitch deb packages

PR open to test travis builds. WIP

not so great... :-1:


text:
ESP32-s3 not working

using the ACM example on an Espressif ESP32-s3 dev kit. Arduino 1.8.19. Library version = 2.00
Example compiles fine and uploads ok.
Plug in any USB device (powered locally as ESP32-s3 host port does not give out 5v!) and ESP32-s3 just continually reboots.
Serial terminal in Arduino shows this:
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x42001d85  PS      : 0x00060930  A0      : 0x8200e002  A1      : 0x3fce4290
A2      : 0x3fce42b8  A3      : 0x00000000  A4      : 0x3fce3c18  A5      : 0x00000000
A6      : 0x00000000  A7      : 0x4200d8b4  A8      : 0x00000000  A9      : 0x3fce4250
A10     : 0x3fce42b8  A11     : 0x3fce42b8  A12     : 0x00060920  A13     : 0x00060923
A14     : 0x00000001  A15     : 0xffffffe7  SAR     : 0x00000017  EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000001c  LBEG    : 0x40056f5c  LEND    : 0x40056f72  LCOUNT  : 0xffffffff

Backtrace:0x42001d82:0x3fce42900x4200dfff:0x3fce42b0 0x42001caa:0x3fce42e0

ELF file SHA256: 0000000000000000

Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40376850
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd0108,len:0x43c
load:0x403b6000,len:0xbd0
load:0x403ba000,len:0x29c8
SHA-256 comparison failed:
Calculated: 0bb45b01207a4a9e9fca8880ddfc0f79112bfa4d004bd1e6b2eaa75c5323b19d
Expected: 6eb14ec480aff4f05e39378c41406102ac163573741e63b6cfd73509ef44e3bd
Attempting to boot anyway...
entry 0x403b61d8
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x42001d85  PS      : 0x00060b30  A0      : 0x8200e002  A1      : 0x3fce4290
A2      : 0x3fce42b8  A3      : 0x00000000  A4      : 0x3fce3c18  A5      : 0x00000000
A6      : 0x00000000  A7      : 0x4200d8b4  A8      : 0x00000000  A9      : 0x3fce4250
A10     : 0x3fce42b8  A11     : 0x3fce42b8  A12     : 0x00060b20  A13     : 0x00060b23
A14     : 0x00000001  A15     : 0xffffffe7  SAR     : 0x00000017  EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000001c  LBEG    : 0x40056f5c  LEND    : 0x40056f72  LCOUNT  : 0xffffffff

Backtrace:0x42001d82:0x3fce42900x4200dfff:0x3fce42b0 0x42001caa:0x3fce42e0

Hi,
i will check it when i have some time, sorry for the problems.

What is output if you're decoding the exceptions?
If you use PlatformIO, add to platformio.ini:
monitor_filters = esp32_exception_decoder
If you use Arduino IDE:
https://github.com/me-no-dev/EspExceptionDecoder

Hi, I have the same issue.
Below decoded stack trace:

Guru Meditation Error: Core  0 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (async)
Core  0 register dump:
PC      : 0x40377463  PS      : 0x00060336  A0      : 0x80377547  A1      : 0x3fcec7d0
A2      : 0x00000054  A3      : 0x00001800  A4      : 0x00000000  A5      : 0x00000000
A6      : 0x00005004  A7      : 0x3fcea020  A8      : 0x3fcec8f0  A9      : 0x3fcec8d0
A10     : 0x3fcea020  A11     : 0x00000000  A12     : 0x3fcef958  A13     : 0x3c03c510
A14     : 0x00000001  A15     : 0xff000000  SAR     : 0x00000014  EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000  LBEG    : 0x400556d5  LEND    : 0x400556e5  LCOUNT  : 0xffffffff
Backtrace: 0x40377460:0x3fcec7d0 0x40377544:0x3fcec800 0x403809c9:0x3fcec820 0x4037ae9d:0x3fcec840 0x4037b140:0x3fcec860 0x40378408:0x3fcec880 0x40378436:0x3fcec8a0 0x40378575:0x3fcec8d0 0x4200ed7a:0x3fcec8f0 0x4200ddd1:0x3fcec910 0x4200d831:0x3fcec930 0x4201d7c9:0x3fcec950 0x4201c2a6:0x3fcec970 0x4201c32e:0x3fcec990 0x4201cf61:0x3fcec9c0 0x42028559:0x3fcec9f0 0x42023fef:0x3fceca10 0x4201d1cd:0x3fcecd20 0x4200201d:0x3fcecd70 0x420024e3:0x3fcecdd0 0x4201120b:0x3fcecdf0 0x42002415:0x3fcece30

Decoded exception:

0x40377463: heap_caps_malloc_base at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:141
0x40377463: heap_caps_malloc_base at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:99
0x40377460: heap_caps_malloc_base at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:138
0x40377460: heap_caps_malloc_base at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:99
0x40377544: heap_caps_malloc_default at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:209
0x403809c9: malloc at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/heap.c:24
0x4037ae9d: xQueueGenericCreate at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/queue.c:447
0x4037b140: xQueueCreateMutex at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/freertos/queue.c:564
0x40378408: lock_init_generic at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/locks.c:73
0x40378436: lock_acquire_generic at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/locks.c:127
0x40378575: _lock_acquire_recursive at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/locks.c:167

Any suggestion?

Sorry, but from the logs it does not look like anything related to library.
It looks like issue with your code (too small task stack)
 Stack canary watchpoint triggered (async)

authors: Steffen-W chegewara clonedesign steeley

repo: chegewara/EspTinyUSB


text:
iOS 13: APNS token is no longer accessible via description property

As of iOS 13, cordova-plugin-firebase-messaging will serve up a garbage string when calling getToken('apns-string').
This fix is adapted from https://onesignal.com/blog/ios-13-introduces-4-breaking-changes-to-notifications/

@jcf120 thanks, I'll do some tweaks and publish a patched version.

@chemerisuk thanks :)


text:
Tracking issue for release 0.10.2

If you want to help with the next release, please add a message here picking one item below! There are a few things only I can do, marked with 🔑 below, and a few other only members of the chemfiles organisation can do, marked with 🗝 below.
Pre-built chemfiles

[x] tag the release on chemfiles/chemfiles
[x] build release on conda-forge (https://github.com/conda-forge/chemfiles-lib-feedstock/pull/44)
[ ] ~try building on Linux: https://build.opensuse.org/package/show/home:Luthaf/chemfiles-staging 🔑~

will not happen, see #437

[ ] ~release Linux builds: https://build.opensuse.org/package/show/home:Luthaf/chemfiles 🔑~

will not happen, see #437

[x] Build release for Julia (https://github.com/JuliaPackaging/Yggdrasil): https://github.com/JuliaPackaging/Yggdrasil/pull/3887

Language bindings
Python

[x] Update the submodule, update code, create PR: https://github.com/chemfiles/chemfiles.py/pull/36
[x] Update code to deal with the new SONAME (i.e. #416)
[x] Tag release 🗝
[x] Create PR on https://github.com/conda-forge/chemfiles-python-feedstock/ (https://github.com/conda-forge/chemfiles-python-feedstock/pull/21)
[x] Build wheels & upload on PyPI 🔑

blocked on https://github.com/chemfiles/chemfiles/pull/438 for sdist

Julia

[x] Update Chemfiles_jll version, create PR: https://github.com/chemfiles/Chemfiles.jl/pull/54
[x] Tag release 🗝
[x] Register the new version on https://github.com/JuliaRegistries/General 🗝 (https://github.com/JuliaRegistries/General/pull/49540)

Rust

[X] Update the submodule, update code, create PR: https://github.com/chemfiles/chemfiles.rs/pull/20
[X] Use pre-built chemfiles downloaded from github when possible (I have a branch doing this locally)
[x] Tag release 🗝
[x] Release on crates.io 🔑

blocked on https://github.com/chemfiles/chemfiles/pull/438

Fortran

[X] Update the submodule, update code, create PR: https://github.com/chemfiles/chemfiles.f03/pull/13
[x] Tag release 🗝

All done!

repo: chemfiles/chemfiles


text:
🛑 Homepage is down

In 1457587, Homepage (https://larrychen.tech) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Homepage is back up in cb4f647.

repo: chendachao/uptime


text:
🛑 tt is down

In cd6155e, tt (https://telebot-app-serverless-i7z8-chenhaonanniubi.vercel.app/checkhealth) was down:

HTTP code: 500
Response time: 2806 ms

Resolved: tt is back up in 9db7292.

repo: chenhaonanniubi/upptime


text:
Update aws-java-sdk-bundle to 1.12.273

Updates com.amazonaws:aws-java-sdk-bundle from 1.12.260 to 1.12.273.
I'll automatically update this PR to resolve conflicts as long as you don't change it yourself.
If you'd like to skip this version, you can just close this PR. If you have any feedback, just mention me in the comments below.
Configure Scala Steward for your repository with a .scala-steward.conf file.
Have a fantastic day writing Scala!

Adjust future updates
Add this to your .scala-steward.conf file to ignore future updates of this dependency:
updates.ignore = [ { groupId = "com.amazonaws", artifactId = "aws-java-sdk-bundle" } ]

Or, add this to slow down future updates of this dependency:
dependencyOverrides = [{
  pullRequests = { frequency = "@monthly" },
  dependency = { groupId = "com.amazonaws", artifactId = "aws-java-sdk-bundle" }
}]

labels: library-update, early-semver-patch, semver-spec-patch, commit-count:1

Superseded by #2276.

repo: chenharryhua/nanjin


text:
查看更多永远展示在右边

这个效果能实现吗？不管几行查看更多永远在右边（多行右下角）

@cwjTerrace ellipsisNode 设置为一个带右 padding 的 '...'，自行实现一个 absolute 定位在容器右下角的 ”详情 >“，默认隐藏，onReflow 中判断是否展示 "详情 >"。

长时间无反馈，先关闭 issue。有需要另开。

authors: chenquincy cwjTerrace

repo: chenquincy/react-ellipsis


text:
assistant支持，长token任务自动分解处理

supported files https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/assistant#supported-file-types

Upload files to use with the Assistant tools. You can upload up to 20 files, with a max size of 512 MB.

repo: chenxizhang/openai-powershell


text:
Run only when generating

Here is a working line of code to add to index.js to run the minifier only when generating the site, not when serving.
if (process.argv.indexOf('server') > -1 || process.argv.indexOf('s') > -1 || process.argv.indexOf('serve') > -1)
{
  return;
}

Ok
PR is welcome.
Also you can set the ENV to development to enable minifier.
const isEnabled = process.env.NODE_ENV !== 'development'
  && (hexo.config.hasOwnProperty('all_minifier') === false || hexo.config.all_minifier === true);

authors: chenzhutian reyemtm

repo: chenzhutian/hexo-all-minifier


text:
Integrate MailChimp into signup dialog

PR Resolved
This PR resolves #13.
Context
This PR integrates MailChimp into our newsletter sign up dialog.
Work Done

Some more styling on dialog and page
Added mailchimp component
Integrated mailchimp functionality

To test
(Please use mouse, keyboard, and screen reader to test)

[ ] Open dialog using the button on homepage. Dialog should open and the main page content should no longer be focusable
[ ] Close dialog using "x." Dialog should close and main content should again be focusable.
[ ] Close dialog using "esc" key. Dialog should close and main content should again be focusable.
[ ] Try to sign up with an incorrect email. Submit button should be disabled and use aria-disabled to prevent keyboard from submission.
[ ] Try to sign up with no email. Submit button should be disabled and use aria-disabled to prevent keyboard from submission.
[ ] Try to sign up with a correct email (doesn't need to be your own). Submit button should be enabled and should open a mailchimp page in a new tab.

Gotchas
This PR addresses mostly functionality, so the styling does not need to look exactly like the Figma just yet. If you do find any significant discrepancies between this PR and the Figma file, though, please do create issue(s) for them! I'd prefer if you collect a lot of small design tweaks into one issue (I can always separate them out if need be).
Learn anything neat? Share it here! Nothing is too small!
For some of the a11y parts of this PR, I referenced the Carnegie museums webpage.

I'm going to go ahead and merge because we need this functionality, but @NiaCLay please still review when you get a chance (no rush).

repo: cherryontech/website


text:
Testing

got some great tests passing!

Changes Unknown when pulling f28adaf7dc3bb153fcd080aa5a0285ed163e7ca5 on testing into ** on master**.

authors: KaraAJC coveralls


text:
POPGO seeker is not available any more.

Since POPGO has been eternally closed, the POPGO seeker is also unavailable now.
This problem has been perceived, and an alternative seeker will be released soon.

A comicat seeker has been added.

repo: chienius/anicolle


text:
Service async function on onProxyReq

Having proxy configured with onProxyReq like:
proxy(gatewayUrl, {
  target: destinationUrl,
  pathRewrite: { [`^${gatewayUrl}`]: '' },
  changeOrigin: true,
  logProvider: () => logger,
  ...options,
  onProxyReq: async (proxyReq, req) => await addAuthHeader(proxyReq, req, redis),
});

Middleware is finishing request before promise is resolved. It is possible to service promise in proxy functions ?

I was also looking at making external calls to add/verify authorization headers but came to the same conclusion. I'm guessing that a viable option is to have another middleware do the external call and have it mutate incoming request headers (would transfer over to onProxyReq). But it would be really nice to be able to do this within http-proxy-middleware having matched the route/pattern of the incoming request.

Looks like there is some demand for async listeners :)
I'll consider implementation after some investigation.
@julmot Can you point to the documented node-http-proxy example?
@magnusp Think you can to achieve the same result by chaining middlewares.
Assuming you use express you can write a authValidator and mount it in express like:
app.use('/some/endpoint', authValidator, proxy)

Im using it via webpack-dev-server which has a configuration property for http-proxy-middleware. The devserver also has a way to setup additional middleware via the "before" and "after" configuration properties. This leaves me having a choice of using my middleware+http-proxy-middleware in a "before" or only setting up my middleware in "before" and using the dedicated "proxy" configuration property. Im mostly mentioning this here for other people stumbling upon the issue and letting them see the options available. But async listeners is an awesome feature. I remember wanting it when implementing a chaos monkey where delays on the proxy were introduced randomly and configurably, at runtime.

@chimurai I have to deal with promises in both proxyReq and proxyRes functions. Would be very helpful to have to have these functions support promises.

+1 one for async
how can I achieve using the result of an async call there?
i am doing something like this
onst buildingConfProxyOptions = {
  target: TARGET_BASE_URL,
  changeOrigin: true,
  pathRewrite: {
    '^/building-conf': ''
  },
  async onProxyReq(proxyReq: any, req: any, res: any) {
    const token = req.headers['authorization'];
    const userSvc: UserService = Container.get(UserService);
    const result = await userSvc.verify(token); // Its ending here
// BUT I NEED TO USE RESULT HERE!

  },
  loglevel: 'debug'
};

For temporary workaround,
I'm doing it like this with promise:
onProxyReq: (proxyReq, req, res) => {
  proxyReq.socket.pause();
  aPromise(a, b).then((c) => {
    proxyReq.setHeader('x-added', c);
    proxyReq.socket.resume();
  }).catch((err) => {
    console.error(err);
    res.sendStatus(500);
  });
},

Or with callback function:
onProxyReq: (proxyReq, req, res) => {
  proxyReq.socket.pause();
  aFunctionWithCallback(a, b, (err, c) => {
    if (err) {
      console.error(err);
      res.sendStatus(500);
      return;
    }
    proxyReq.setHeader('x-added', c);
    proxyReq.socket.resume();
  });
},

Is this plausible at all?

@shian15810 Did you try? Does it work?

Yeah, it works!
By plausible I mean does this really make sense?

Seems reasonable. I'm guessing that the proxyReq.socket should probably be aborted when an error occurs  otherwise it could be left hanging until aborted by an timeout in either end.

@magnusp Do you mean something like socket.end() after res.sendStatus(500)?
Or should it be better off if I get rid of res.sendStatus(500) and use socket.end('HTTP/1.1 500 Internal Server Error\r\n\r\n') instead?

@shian15810 How did you set the header.  When i try to set the header via proxyReq.setHeader('a','g'), i get an exception throwing
Cannot set header after they are sent to the client.
how did you get around that part? I followed the first promise example
Thanks!

@darewreck54 I was having this issue too, and after looking into the source code, at least for me, I couldn't find any way to circumvent this situation, even when using req.headers[customHeader].
But having custom header is essential to the functioning of my application. So finally I decided to change the whole architecture to microservice-based. Sorry, couldn't be much of your help.
If you don't need custom header for your application to be functional, the hack I proposed earlier is still a feasible way to get around the original issue.
Using req.headers[customHeader] won't give you that annoying error, but the header won't reach the upstream server anyway.

I actually end up creating my own express middleware that execute the promise and when its successful it will trigger next().  I'll store the updated header in the request and send it to the proxy middleware

@chimurai did you create a solution to this? Also if not can you provide an example of the authValidator you mentioned?

For temporary workaround,
I'm doing it like this with promise:
onProxyReq: (proxyReq, req, res) => {
  proxyReq.socket.pause();
  aPromise(a, b).then((c) => {
    proxyReq.setHeader('x-added', c);
    proxyReq.socket.resume();
  }).catch((err) => {
    console.error(err);
    res.sendStatus(500);
  });
},

Or with callback function:
onProxyReq: (proxyReq, req, res) => {
  proxyReq.socket.pause();
  aFunctionWithCallback(a, b, (err, c) => {
    if (err) {
      console.error(err);
      res.sendStatus(500);
      return;
    }
    proxyReq.setHeader('x-added', c);
    proxyReq.socket.resume();
  });
},

Is this plausible at all?
This works fine on onProxyReq but doesn't work on onProxyRes when trying to set the header. The header never reaches browser.

@julmot any links to the example in http-proxy will be great.
@chimurai any work around / solution on getting this working with onProxyRes?

@shian15810 I somehow can't get it quite to work:
function onProxyReq(proxyReq, req, res) {
        proxyReq.socket.pause();
        setTimeout(function() {
                proxyReq.setHeader('X-IRIS-USERNAME', 'admin');
                proxyReq.socket.resume();
        }, 1000);
}

which results to:
throw new ERR_HTTP_HEADERS_SENT('set');
^

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ClientRequest.setHeader (_http_outgoing.js:470:11)

Is anything that I might be missing?

So for the others that might be looking, I've ended up as well writing a middleware that stores the value into the req. For example:
app.use(function (req, res, next) {
  aFunctionWithCallback((err, res) => {
    req._username = res.username;
    next();
  });
});

and later on:
  "onProxyReq": function(proxyReq, req) {
    proxyReq.setHeader('X-AUTH-USERNAME', req._username);
  },

Probably not plausible at all, but it does work.

Thanks @dpetrov this works here to. you dont event have to use onProxyReq, headers will get forwarded by the proxy later on
server.use((req, res, next) => {
  if (req.path === "/graphql" && req.method === "POST") {
    getSomethingAsync(req.session.id, (err, data) => {
      if (data) {
        req.headers["Authorization"] = `Bearer ${data.user.token}`
      }
      next()
    })
  } else {
    next()
  }
})

no way @revolunet you are here too

Are there any constraints in the library that would block a community PR for this @chimurai?
Was able to work around with a middleware that fires before my proxy middleware

There was a PR last year on http-proxy for this.  Without async support, and after looking into the code of http-proxy.  Im not really sure this lib is something I want in my codebase.
And without async support in handlers even though it might be somewhat trivial to implement, I didnt really get a warm fuxxy when I looked at the internals.
Ill just use a library with keep alive and call it good.

@chimurai Steven bouw deze feature even erin man :)

I tried with selfHandleResponse option, and it seems working in this middleware as well.

@chimurai Steven, ik heb hem werkend :)
So i have this setup where i can still alter the response header AFTER i get the response and do async stuff. In this sample i also included the fake server im mocking to (3001).
const http = require('http');
const express = require('express');
const proxy = require('http-proxy-middleware');

const HTTP_PORT = 3000;
const HTTP_INTERNAL = 3001;

const app = express();

// first async middlware doing something async
const entryMiddleware = async (req,res,next) => {
    const foo = await new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve({ 'da': 'wei' });
        }, 200);
    });
    req.locals = {
        da: foo.da
    }
    next();
};

// Now see our chain
app.use(
    '/',
    entryMiddleware,
    proxy({
        target: 'http://localhost:3001',
        changeOrigin: true,
        selfHandleResponse: true,
        onProxyReq: (proxyReq, req, res) => {
            // just check if headers are good set in previous middleware
            console.log('proxyReq:', req.locals.da);
            proxyReq.setHeader('mpth-1', 'da');
        },
        onProxyRes: async (proxyRes, req, res) => {
            console.log('onProxyRes');

            const bar = await new Promise((resolve, reject) => {
                setTimeout(() => {
                    resolve({ 'wei': 'da' });
                }, 200);
            });

            res.setHeader('mpth-2', bar.wei);

            proxyRes.pipe(res);

        }
    }),
);

// proxy server
const httpServer = http.createServer(app);
httpServer.listen(HTTP_PORT, () => {
    console.log(`🚀 proxy started on ${HTTP_PORT}`);
});

// fakse proxy endpoint, just local overhere
http.createServer(express().use('/', (req, res, next) => {
    console.log('req', req.headers['mpth-1']);

    res.send({ baba: 'yaga' });

})).listen(HTTP_INTERNAL, () => {
    console.log(`🚀 dummy service started on ${HTTP_INTERNAL}`);
});

curl -I http://localhost:3000 gives now:
HTTP/1.1 200 OK
X-Powered-By: Express
mpth-2: da
Date: Thu, 19 Nov 2020 21:53:43 GMT
Connection: keep-alive

where mpth-2 is set async.
all i had to do was use proxyRes.pipe(res); just by digging in the code :(

感谢@dpetrov这里也行得通。你甚至不必使用， 头稍后会由代理转发onProxyReq
server.use((req, res, next) => {
  if (req.path === "/graphql" && req.method === "POST") {
    getSomethingAsync(req.session.id, (err, data) => {
      if (data) {
        req.headers["Authorization"] = `Bearer ${data.user.token}`
      }
      next()
    })
  } else {
    next()
  }
})

your answer is good

@dpetrov and @revolunet you are lifesavers. This worked for me 👍 Thank you

server.use((req, res, next) => {
  if (req.path === "/graphql" && req.method === "POST") {
    getSomethingAsync(req.session.id, (err, data) => {
      if (data) {
        req.headers["Authorization"] = `Bearer ${data.user.token}`
      }
      next()
    })
  } else {
    next()
  }
})

@pawelszczerbicki
delete http-proxy-middleware and use just http-proxy
my example:
import http from 'http';
import httpProxy from 'http-proxy';

var proxy = httpProxy.createProxyServer({});

const handler = async (req: any, res: any) => {

    const status = await checker(req)
    if (!status) {

       res.statusCode = 403
       res.write("Forbidden")
       res.end()
    }

    proxy.web(req, res, {
        target: target_host
    });
}

var server = http.createServer(handler);

server.listen(3000);

2024: Still no async/await support :/

authors: Austio Hosstell SreeBS blastshielddown boxcee chimurai darewreck54 dpetrov dschweinbenz kavitalikesfajitas kwiss maapteh magnusp mihir83in montera82 pawelszczerbicki powpowshen revolunet shian15810 smileatom zhuibo66

repo: chimurai/http-proxy-middleware


text:
ResponseInterceptor recipe types mismatch

yarn why http-proxy-middleware OR npm ls http-proxy-middleware output (mask private folder names with *****)
comet@0.0.1 *****
├─┬ @types/http-proxy-middleware@1.0.0
│ └── http-proxy-middleware@2.0.0 deduped
└── http-proxy-middleware@2.0.0

[X] I understand project setup issues should be asked on StackOverflow or in GitHub Discussions.
[X] I updated to latest http-proxy-middleware.

Describe the bug (be clear and concise)
TL; DR;
When using responseInterceptor on onProxyRes, types doesn't match.
In detail...
I wanted to handle response. So I used a function on [onProxyRes] (https://github.com/chimurai/http-proxy-middleware/issues/97#issuecomment-268180448).
but I didn't get the response as I wanted..
(Response was broken and I think it's related to decompressing... it's not the issue I wanna report anyways)
So, instead of using this
proxyRes.on('data', ....)

I used responseInterceptor with your recipe
I'm using Typescript also, and unfortunately,
responseInterceptor's return value doesn't comply to onProxyRes.
Step-by-step reproduction instructions
I attached my code here.

https://gist.github.com/hotsummmer/387aba337e4a62ee0182a4587995f3db

Expected behavior (be clear and concise)
responseInterceptor expects arguments as below
(buffer: Buffer, proxyRes: http.IncomingMessage, req: http.IncomingMessage, res: http.ServerResponse)

but if I want to use it directly onProxyReq,
types doesn't match.
Because onProxyRes expects this type.
onProxyRes: (
        proxyRes: IncomingMessage,
        req: Request,
        res: Response,
    ): void

It works if I use any as expected type... or convert types before passing it to responseInterceptor.
But wanted to ask you first about this issue
What http-proxy-middleware configuration are you using?
Line 16~33.

https://gist.github.com/hotsummmer/387aba337e4a62ee0182a4587995f3db

What OS/version and node/version are you seeing the problem?
MacOS 11.4, Node 12.18.3

Additional context (optional)
I appreciate your work and wonderful recipes!
Happy to use it and contribute :) thanks ❤

Think this has been fixed in this PR https://github.com/chimurai/http-proxy-middleware/pull/60.
But it hasn't been published yet.

Just published v2.0.1.
onProxyRes is now typed as:
onProxyRes: (
  proxyRes: http.IncomingMessage,
  req: http.IncomingMessage,
  res: http.ServerResponse
): void

Hopefully it won't give conflicts anymore.
Let me know if the issue persists.

Just published v2.0.1.
onProxyRes is now typed as:
onProxyRes: (
  proxyRes: http.IncomingMessage,
  req: http.IncomingMessage,
  res: http.ServerResponse
): void

Hopefully it won't give conflicts anymore.
Let me know if the issue persists.

Wow. Thanks for taking care of it right away 👍  I will check on it!

Due to the change of the req type from Request to req: http.IncomingMessage,
Typescript now complains when using req.get to retrieve header values when using the middleware with Expressjs. Could we possibly extend the types here so that both are compatible?

@alsoscotland Could you share the code snippet you're using?

@chimurai sure.  Thanks for the quick response:
Here is a simplified version.  Essentially for the case where I want to pass some headers through from the original request to the proxy request
export const onProxyReqFn = (
        proxyReq: ClientRequest,
        req: Request
        // res: Response
    ) => {
    const authHeader = req.get('authorization');
    if (authHeader) {
        proxyReq.setHeader('authorization', authHeader);
    }
};

Does this break the documentation?  I'm getting '[object Object]' when running const response = responseBuffer.toString('utf8');

authors: BinarySpike alsoscotland chimurai hotsummmer